I’m working on a dynamic form in Pega 8.5 where field visibility should update based on data page refresh. The form has a dropdown that triggers a data page reload, and certain fields should show/hide based on the returned values.
The issue is that after the data page refreshes successfully, the visibility conditions don’t re-evaluate. I can see in the tracer that the data page is refreshing and returning updated data, but the section rules with when conditions aren’t picking up the changes until I manually refresh the entire page.
My visibility condition references: .CustomerType = "Premium" from the refreshed data page. The data page refresh is triggered by a custom UI action on dropdown change:
this.refreshDataPage("D_CustomerDetails");
this.refreshSection("CustomerFormSection");
The section rule configuration uses standard when conditions, and I’ve verified the property references are correct. Has anyone encountered this with data page refresh behavior in section rules? What’s the proper way to handle UI action event handling to force visibility re-evaluation?
Let me provide the complete solution based on your specific scenario. The issue stems from how Pega 8.5 handles data page refresh behavior in conjunction with section rule visibility conditions. Here’s what you need to fix:
1. Data Page Refresh Behavior Fix:
First, verify your data page is configured with Edit Mode set to “Savable” and Scope appropriate for your use case. The refresh must actually reload data, not just return cached results.
2. Section Rule Configuration Update:
Your when condition is correct, but you need to ensure the section is configured to refresh on property change. In your section rule, go to the Advanced tab and check “Refresh when property changes” - then specify .CustomerDetails as the watched property.
3. UI Action Event Handling - Critical Fix:
Your current code is close but missing the property notification. Update your UI action:
this.refreshDataPage("D_CustomerDetails");
this.getProperty("CustomerDetails").markDirty();
this.refreshSection("CustomerFormSection");
The markDirty() call is crucial - it tells the UI framework that properties dependent on this data page need re-evaluation. This triggers when condition recalculation.
4. Alternative Declarative Approach:
If you want to stay purely declarative, create a declare expression that copies .CustomerDetails.CustomerType to a local property like .LocalCustomerType. Set the declare expression to run “whenever inputs change” with CustomerDetails as input. Then reference .LocalCustomerType in your when conditions. This creates a proper dependency chain that Pega’s UI framework recognizes.
5. Verification Steps:
- Clear your browser cache completely
- In tracer, filter for “Declare_” to verify declare expressions fire
- Check clipboard for
.CustomerDetails to confirm data is actually changing
- Verify when conditions by temporarily changing them to always-true to isolate the issue
The root cause is that direct data page property references in when conditions don’t establish proper UI refresh dependencies in Pega 8.5. The markDirty() approach or declare expression pattern creates the necessary linkage for automatic re-evaluation. This is a known behavior that was improved in later Pega versions (8.7+) where data page refresh handling is more intelligent.
I’ve used both approaches successfully - markDirty() for simple cases, declare expressions for complex multi-field scenarios. Choose based on your form complexity and whether you need the intermediate property for other logic.
The declare expression approach can work, but there’s actually a simpler solution. Your UI action needs to include a specific refresh strategy. Instead of just refreshing the section, you need to refresh the specific properties that your when conditions depend on.
Also, check your data page configuration - is it set to reload or reuse? If it’s set to reuse and the keys haven’t changed, it might not actually be fetching new data even though you’re calling refresh. The tracer might show activity but not actual data retrieval. I’d verify the data page scope and reload strategy first before changing your visibility implementation.
I’ve seen this exact behavior. The problem is that refreshSection alone doesn’t always trigger when condition re-evaluation in Pega 8.5. The data page refreshes, but the UI framework doesn’t know it needs to check visibility conditions again.
Try adding a property refresh explicitly after your data page refresh. The section needs to be notified that properties it depends on have changed. Have you checked if your when condition is using a direct property reference versus a page reference?