LinkedIn
Copied!

Table of Contents

Savable data pages

Version:

Only available versions of this content are shown in the dropdown

Use a savable data page to save data to a system of record without using an activity.

By keeping the persistence logic with the data page, the logic is reusable and consistent.

You can create a save plan for a savable data pages in the following ways:

  • Save data directly to the database by selecting Database save in the Data save options section of the Definition tab of your data page.
  • Process the data before saving it into the database by selecting Activity in the Data save options section of the Definition tab of your data page. You would then use, for example, an Obj-Save step, Connect-REST/SOAP, step, or other code to save the data page.
  • Save data to external systems of record by using Robotic automation or Robotic desktop automation.
  • Save and persist data by selecting a REST Connector. You can make a REST call by selecting a POST, PUT, or PATCH method.

You can trigger the saving of a data page in the following ways:

  • In a Flow Action, you can list the data pages to save as part of postprocessing. You can optionally list a When rule for each data page to control which data pages are saved after the Flow Action, based on conditional logic.
  • In a Flow, use the Save Data Page smart shape after an assignment.
  • Instead of using a Flow Action or Flow, you can use the Save-DataPage method to save the data page to a database or call a connector if you are saving to an external database.
    If you use the data page with a save option to save work items, this option unlocks the current work item as well as its parent work items. Unlocking parent items degrades performance, and other users cannot access the parent items while they are unlocked. To save work items, use the Obj-Save activity method or the RecalculateAndSave API with clipboard pages.

WriteNow parameters

When you save a savable data page, there is an option for WriteNow. When true, the save occurs immediately as an independent transaction. When false, the save is deferred and is included in a larger transaction that they will eventually commit.

Flow Actions and the flow Flow smart shape always set WriteNow to false when they save a savable data page. The activity method exposes WriteNow as a parameter and you set its value.

When you use the Database save save plan option, you do not have to set WriteNow; the Pega Platform sets it.

When you use the Activity save plan option, include the WriteNow parameter. Its value is based on what the caller specified when it saved the data page. If your activity persists the data using one or more Obj-Save steps, set the WriteNow value on the Obj-Save steps based on the value of this parameter. If your activity persists the data using other methods, such as a connection, ignore the value of this parameter and include rollback and compensating actions in your process to handle failures when some persistence already occurred.

Do not include commit steps in save plan activities, regardless of whether the activity is WriteNow or not because the transaction being committed might include deferred saves from outside of your activity.

WriteNow is not available for robotic automation saves. Robotic automation saves are done as independent transactions. If you need rollback or compensating actions in the case of an error, include that logic later in your process.

When rules

If you add a save option, you must specify a When rule.

If you have multiple save plans, the system evaluates the When rule for each save plan, which means that every save plan whose When rule evaluates to true is executed. The Otherwise save option is executed if the When rule for every save plan evaluates to false.

This functionality for When rules in save plans differs from the functionality for When rules in data sources. For data sources, When rules stop processing at the first occurrence of a When rule that evaluates to true, which means that only one When rule is executed.

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.