Handling data page errors by using a data transform
To specify error handling for each data source in your data page, use a data transform. You can use this data transform across multiple data sources and data pages in the application. For example, with an activity data source, the same data transform can be used to handle data page errors.
Pega Platform provides various ways to handle data page errors.
Because data pages are inherently declarative, error handling needs to be contained
within the data page load process. As a best practice, use a response data transform
that can detect the type of data source and handle the errors appropriately.
- In the navigation pane of Dev Studio, click Records.
- Expand the Data Model category, and then click Data Page.
- Click the name of the data page to open it or create a new data page.For more information, see Creating a data page.
- On the Definition tab, in the Data
Sources section, identify the data source type in the
Source field.The error handler must be able to identify the type of connected data source so that it can customize the solution. To identify the data source, use a response data transform or activity step for every data source.
- Connector: Use a response data transform to detect and handle Connector data source errors.
- Report definition: Use a response data transform to detect and handle Report Definition data source errors.
- Lookup: Use a response data transform and select the Run response data transform on error check box to detect and handle Lookup data source errors.
- Data transform: Use the hasMessages when condition to detect and handle data transform data source errors.
- Activity: Use appropriate transition conditions such as StepStatusFail in activity steps to detect and handle activity data source errors.
- To create the error handler, create a data transform by saving the default data
transform pxErrorHandlingTemplate to your top-level class
and ruleset.
- In the header of Dev Studio, search for and then select the pxErrorHandlingTemplate data transform.
- In the data transform rule form, click Save as,
and then save the data transform to your top-level class and
ruleset.For more information, see Configuring a data transform.
- From the data page, pass a parameter (for example, Connector-GetCustomerData) to the response data transform to uniquely identify the data source that is used to load the data page.
- On the Definition tab of each response data
transform, use the when condition
pxDataPageHasErrors to identify any errors in
the data page and apply the MyCoErrorHandlerMaster
data transform.For more information, see Data transform actions for Clipboard.
- In the MyCoErrorHandlerMaster data transform,
create and call a decision table that determines the appropriate error
handling based on the data source.For more information, see Creating decision tables.
- Based on the decision table, perform the error handling action for the data source in the MyCoErrorHandlerMaster data transform.
- In the MyCoErrorHandlerMaster data transform,
create and call a decision table to map user-friendly error messages
instead of the default error messages.
For more information, see Creating decision tables.
Previous topic Changing the data source of a data page Next topic Robotic automation as a data page source