Form refresh settings: The artist formally known as “on change, run data transform..”

Why

“Form refresh settings” ensure users interact with the most up-to-date information within forms. In Traditional UI, action sets were used to build complex UI events based on things like click or change, to then update data or refresh parts of the UI.

In this article, we explore achieving the same business outcome in Constellation.

When to use

This article covers a few scenarios on when you can use this. The most important aspect is we are using this to refresh data for the current form – the examples are a simple demonstration of what can be achieved:

  • When Field A changes, I want to update Field B. When a scalar field change, I want to change the value of another scalar property on screen

  • Prefill a table (list) with information from my form. When a scalar field changes, I want to change an embedded field on screen.

  • Validate a field on change . When a scalar field changes, I want to run a validation rule against this.

Prerequisites

A flow setup with user actions and fields or in Dev Studio:

  • A process

  • A flow action

  • A view

  • Properties

  • A data transform to run in response to a field changing

When not to use

  1. Cascading Dropdowns - Although we can use this to create cascading dropdowns, with the right data model setup, this is not required.

    1. See Configurating cascading dropdowns
  2. Calculations – Although this could be used to calculate a value, for example “length of stay” for a hotel booking, Pega provides tools to provide a robust data model. This provides a scalable model and avoids logic being stored in the User Interface. Calculations (declare expressions) are built into the Constellation Design System, ensuring inputs are listened for and values updated without manually developing events to do this.

    1. See Creating a calculated field
  3. Updating fields outside the form* – This is designed to update fields in the form, to help with the end user experience.

    1. When executing a refresh data transform, the data modifications performed to the properties in the data transform will be merged to clipboard only if those modified properties are added as editable fields in the View. If the modified properties are either in Read-Only mode in view or the ones which are used for internal processing, those values will not be available after the submit.
  4. Listening for complex fields (aka changes to a list)*

    1. A refresh data transform on flow action can only be configured for a scalar property like .Category in the work page level. For an embedded page property like .Address.ZipCode this is not a supported configuration for Form Refresh setttings.

    2. scalar fields supported.png

*For items 3 and 4 above, you should explore data transform smart shapes in your flow or pre/post processing on the user action if there are other requirements.

Scenario 1: When Field A changes, I want to update Field B

Let’s start simple. When I tick that I need my order today, then we should update Shipping Date to today’s date.

Steps

  1. Open the Dev Studio

  2. Open the Flow Action rule

  3. Add a new condition to your “Form refresh settings”

  4. Create a new condition to look for changes in the “I need my order today” and select the data transform to run

  5. In this example, the data transform I created looked like this

  6. The result, is when I ran this on the 11th of July

Scenario 2: I want to prefill a table (list) with information from my form when it changes

Building on the previous scenario, we are in a single form, and we want to have interaction between a field on screen and a list of items that need completing. In our scenario, we could ask the question “How many people live in your household?” and based on this we could prefill the number of records in that list.

Important aspect of this scenario

  • All whilst on the same form.

  • Our form for this demonstration will be the Hierarchial form template, a new feature in 24.2. Whilst this breaks the UI up into “tabs”, this is still a single form configured in your application.

  • Personally, if I were tackling this scenario, I would recommend a regular process or multi-step form (screenflow). However, we have seen scenarios where a single assignment in a hierarchical form is preferred for other User Experience reasons. This would be that scenario.

Steps

  1. Open the Dev Studio

  2. Open the Flow Action rule

  3. Add a new condition to your “Form refresh settings”

  4. Create a new condition to look for changes in the “People in my household” and select the data transform to run

  5. In this example, the data transform I created looked like this – a very simple example just for demonstration (and in real life would be optimised better).

  6. The result

    1. When I open the form

    2. When a I change the value for number of people applying

Scenario 3: I want to validate a field on change

Now we are going to get more complex, I’ll speed up the configuration as we’ll assume you know the pieces from scenario 1. We want validation to happen on entry of a field.

Important design caveat

  • Pega’s OOTB validation is usually done on submit of a form

  • The low code authoring platform is geared to provide this in a simple and scalable way.

  • By introducing validation on entry for this one field, you may be introducing a design pattern that

  • will take longer to implement

  • harder to maintain and

  • Introduces the risk of bugs.

Careful consideration should be made to implementing change validation like this.This example illustrates how the Form Refresh settings can be used flexibly in the Constellation Design System, not should be.

Steps to implement

In this case, for my example, let’s say we want to stop erroneous names from being entered. We have a blacklist of entries, in this example, “whatever”.

  1. Create a Form Refresh Setting that runs a data transform and triggers the desired validation.
    1. In this example, the data transform is running an activity that then runs the validation rule.
    2. You will also notice this example; I’m using the Form template, hierarchical form. To demonstrate this works with different form types as well.
  2. Full configuration

Tip

Form refresh settings can not be used to cascade changes across a network of properties (e.g. declarative network). For example, when ‘first name’ changes, then update ‘full name’ – when full name changes, update ‘display name’.

The listening event will only trigger one data transform, not a cascading network of data transforms. Careful consideration of your design should be taken to ensure your UI updates appropriately.

Conclusion

Form refresh settings is a powerful tool in Constellation to help listen for different field changes to ensure the data on your form is always up to date. It should be used in conjunction with other Pega tools such as pre/post processing, calculations (declare expressions) and datapages to build a robust data model that updates as needed.

Additional Reads

Constellation 101 series

Enjoyed this article? See more similar articles in Constellation 101 series.

@MarcCheong Thats awesome update and also it seems this approach is performancr complaint as well.

thanks for sharing this :+1:

@MarcCheong Greatly demonstrated thanks for sharing the info, really useful.

@MarcCheong There is one component which basically is used in display as option when configuring a text field in view. On selection of that field the form does not refresh but it refresh when selecting option from drop down and then clicking some where else in the form it is refreshed.

@MarcCheong Using this approach, if we set any read-only properties on the form, these details are not saved to the database upon submission. We then need to implement the same logic again in the post-processing. Is there a solution for this?

@PranavD16921175 on change of a field in a form, assuming you have the refresh strategy set up correctly, this should fire. There are exceptions for more advanced data in 24.2 (updated in 25). However, if it’s not firing I would be raising a support ticket to confirm if there is a bug or configuration issue.

@MarcCheong

Really nice article .Thanks for sharing

Is there any posssibilty to refresh the view after selection of a property of type Data reference (Shown as a table)?

Or is there any possibility to load a data page after selection of property of type Data reference (Shown as a table)?

@NUPURR79 Views in Constellation auto-refresh - there’s logic in place in the design system to ensure this happens. What business outcome are your trying to achieve? Show more details about the selected data reference?

  1. When you have a data reference, you can select to show additional details about the selected item.
  2. '25 does bring in some more enhancements around page list properties Pegasystems Documentation
  3. You could invalidate the datapage as part of the data transform you run?
    1. How to notify users to refresh an outdated List View in Constellation UI | Support Center

Let us know

@KrishnaHCC 8.7.6? wow, yeah, I had a lot of issues early days with Form Refresh Settings in 8.8 days, even in '23. There were more limitations than specified in this '24 article and likely a few bugs. I typically used pre/post or run data transform in the case flow to achieve what I needed back then…

I can’t specifically point you in the direction of an immediate “how to” on why that isn’t working. I’d suggest raising an INC on My Support Portal so they can look at your configuration to try to fix. However, if its working in '25 then you clearly know the configuration, I feel it might be a limitation of your older version.

@chandrasekharv3935 @VivekS0329 most welcome.

@SharathChandraM3995 that is correct. DX API will not allow you to update a field that is read only on a Form. You’d find the same if you tried to build DX Components or SDKs.

Form refresh is just to control the data on the current form, obviously there will be scenarios where you need to do post processing to update other data, outside of your current form.

@MarcCheong Thanks for sharing this article. I’ve successfully implemented as per scenario 3 (i.e. On Field Value changes) in Pega 25.1 and it’s working fine as expected as per business needs.

However, I’ve tried to populate the date value based on another date value changes, followed exactly the similar steps in Pega 8.7.6 via Refresh Settings within Flow Action but it’s not working. Please guide me anything specific that I need to be aware of in this regard.

Happy to share detailed step-by step if needed.

see a '25 version of this, by @AydınToprak, focusing on the enhancement added for keeping lists up to date (aka multiple records [App Studio], aka pagelists [Dev Studio)