Skip to main content

Savable data pages

Savable data pages

You can use savable data pages to save a page or page list of data specified in a data page back to its system of record (SOR) regardless of whether the SOR is Pega Platform™ or another system like an external database. By using a savable data page, you can configure an application to update the SOR in real-time with case data. The savable data page can manage the transaction to ensure that both systems remain synchronized even if an error, such as a network outage, occurs.

For example, a company named TGB uses an external database as an SOR to hold Human Resources (HR) data, including a database table that stores data about employee seating locations. During employee onboarding, an HR representative assigns employees an unoccupied office or cubicle. Once the HR representative submits the seating assignment, the application updates the record for the seating location in the SOR with the employee ID of the assigned employee to prevent another user from selecting the same seating location when onboarding another employee.

Savable data page and save data page step

Data save plan

The data save plan for a savable data page details how saves are performed. You specify the data save plan in the data save options section of the savable data page. You can specify multiple save options, where each save option is associated with a when rule that determines when that save option is used. The data save options include: Database save, Activity, Connector, Robotic automation, and Robotic desktop automation.

Note: When you want to commit to multiple data tables at a time, you can use when conditions in the data save plan. Whenever the when condition evaluates to true, then the data commit is performed. If all the When conditions evaluate to false, then the Otherwise condition is executed.

In the following image, click the + icons to learn more about the data save options.

Transaction handling

By using savable data pages, you can write data to the SOR using Pega Platform's built-in transaction handling. 

Consider an example that does not use transaction handling. You purchase an item online and pay using your credit card. The bank processes your credit card payment, but the online store never receives a notification about your payment due to a network issue. With transaction handling, the payment and payment notification is performed in the same transaction. If part of the transaction fails, the changes to both systems roll back to the state before the update to either system was attempted. Your credit card is not charged, and your order is not processed.

You can trigger the save plan for a savable data page in one of three ways.

  1. Add a Save data page automation step in a flow rule.
  2. Add post-processing for a flow action rule.
  3. Call the Save-DataPage method in an activity rule.

When triggering the save from a flow or a flow action, Pega Platform automatically manages the transaction. If you trigger the save from an activity rule, you can choose whether to save the data in conjunction with the rest of the transaction or independently as a separate transaction.

Check your knowledge with the following interaction.

Data instance update and data instance creation

Auto-populated properties are page or page list properties that automatically obtain data directly from specified data pages. These properties make the applications that you build easier to manage and maintain preventing the application from having to constantly monitor changes in key parameters, which are not always required and may slow performance. You can auto-populate a page or page list property by either referencing a data page or copying data from a data page.

You can use a savable data page as the source for an auto-populated property. In this situation, Pega Platform uses the Data source section of the data page record to populate the property with data, and the Data save options section to update the data source.

Caution:  When you source an auto-populated property with a savable data page, refer to the property with the Copy data from a data page option rather than the Refer to a data page option. Using the Refer to a data page option may lead to an accidental overwrite of data before you trigger the save.

Use cases for savable data pages primarily involve accepting a value used to uniquely identify a record using Lookup as the source. This value is usually a manually-set key value or another unique string like an e-mail address. The response data transform handles any "failed to find" error by clearing the error and applying defaults to the page (usually by calling the pyDefault data transform of the class). This sets up the record as new. However, when the value is not manually set, such as in the case with autogenerated keys, a savable data page can use a data transform as the data source.

Data page task Is a key value present? Source
Updating data instance Yes  Lookup
Creating data instance No Data transform

Data save plans 

You can configure a savable data page with multiple data sources and data save plans to support both creating and updating data records. For example, an auto-populate property contains account information for a user sourced using a savable data page. The user may be a repeat customer with a record in the SOR, or a new customer intending to register and create an account record. The data save plan changes depending on if there is a record present: 

  • If a record for the customer is present in the SOR, the data page can use a lookup to source values for the auto-populated property, passing the key value for the record as a parameter. The data page writes updates back to the SOR using the Database save operation, again passing the key value for the record as a parameter.
     
  • If no record is present in the SOR, the data page sources values for the auto-populated property using a data transform and no parameter is passed. The parameter is omitted from the Database save operation as well.

If the data page supports both create and update operations, you may need to ensure that any parameter for specifying a key value is optional, rather than required. If the data source uses an autogenerated key passed by a required parameter, the database save operation for creating the record requires the key value, causing an error that prevents saving the data page record.

Tip: As a best practice, add an Index parameter to a savable data page used for creating records, unless you intend to use an autopopulate by copy property. This avoids the guardrail violation and allows that data page to be used multiple times on the same screen.

Check your knowledge with the following interaction.

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

100% found this content useful

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice