Edit Content

Novitates Tech is committed to shaping a digital landscape that empowers businesses globally, offering accessible transformative solutions that ignite industry-wide change. Our dedication to innovation drives us to create strategies that redefine global business operations.

Get in touch

Introduction

In Pega Constellation, a refresh request triggers the execution of business logic and updates the case data based on the input from UI. This updated case data is then returned as a JSON response. However, in certain scenarios, additional processing may be required to update specific fields that are not updated/committed to the case but need to be reflected on the UI for the next set of updates/commits.

To address this peculiar situation, we can make use of a Pega provided extension point named pyRefreshData, a Data Transform (DT) located in the base class, which can be extended to specific case type classes or application rulesets to write custom logic.

Relevance

The pyRefreshData extension point is highly beneficial for cases where updates to a list or complex properties require additional data manipulation. Specifically talking about non-scalar properties.

Common Use Cases:

  1. Multi-Select Dropdown Updates:
    • Adding or deleting entries in a multi-select autocomplete dropdown.
  2. Editable Table Modifications:
    • Adding or updating rows in an editable table.

Note: Scalar properties (simple fields) have form refresh settings for data changes in flow action rule, but non-scalar properties are not supported for the same. This extension point provides a workaround.

Important Considerations:

  • The pyRefreshData DT executes with every refresh request.
  • This extension point does not replace the form refresh feature for scalar properties.
  • Custom logic must include appropriate conditions to prevent unnecessary updates, ensuring only relevant data is modified and sent to the UI.

Implementation and Usage

Scenario: Multi-Select Dropdown

Consider a scenario where a multi-select dropdown allows users to select or remove multiple entries. For every selection or removal, the following actions occur:

  • Dropdown Interaction:
    • User expands the dropdown and selects/removes entries.
  • Pega Processing:
    • A DX API refresh request is sent to Pega.
    • Pega updates the case data.
    • The pyRefreshData DT is triggered.
  • Response Preparation:
    • The pyWorkPage is converted to JSON, and the caseInfo.content is updated with the modified data.
    • This updated content is rendered on the UI.

Example Workflow:

  1. Initial Setup:
    • Create or extend the pyRefreshData DT in the relevant case type class.
    • Define custom logic for modifying the Primary page content (e.g., caseInfo.content).
  2. Dynamic UI Updates:
    • Add or remove entries in the dropdown, which dynamically updates a table displayed below.
    • The updated table is rendered immediately without committing changes to the case.
  3. Final Commit:
    • When the user completes the assignment or moves to the next screen, the UI data is sent back to Pega.
    • The flow processing logic saves or commits the updated data to the case.

Key Advantages

  • Enables dynamic UI updates for non-scalar properties without committing changes.
  • Provides flexibility to extend business logic for custom scenarios.
  • Ensures seamless synchronization between UI and case data for complex updates.

The pyRefreshData extension point may not be applicable to every scenario, but it is invaluable for handling refresh requests where dynamic data updates are required before screen reloads. By incorporating this extension point, developers can enhance user experience and ensure data consistency in Pega Constellation applications.

Continue reading