This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.
LinkedIn
Copied!

Table of Contents

Handling data page errors by using a data transform

The Pega 7 Platform provides various ways to handle data page errors. Because data pages are inherently declarative in nature, error handling needs to be contained within the data page load process. A best practice is to use a response data transform that can detect the type of data source and handle the errors appropriately.

Identifying the data source type

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, as shown in the following figure:

  • Connector: Use a response data transform to detect and handle Connector data source errors.
    Response data transform for connector data source
  • Report Definition: Similar to Connector, use a response data transform to detect and handle Report Definition data source errors.
  • Lookup: Use a response data transform with the Run response data transform on error check box selected to detect and handle Lookup data source errors.
    Response data transform for Lookup type data source
  • 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.
    Failover step for activity type data source

Creating the error handler

Create your custom error handler by using the default data transform.

  1. Create a data transform (for example, MyCoErrorHandlerMaster) by saving the default data transform pxErrorHandlingTemplate to your top-level class and ruleset. Also, change the status of the rule from Final to Available.
    Custom error handling data transform
  2. 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.
  3. 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.
  4. In the MyCoErrorHandlerMaster data transform, create and call a decision table that determines the appropriate error handling based on the data source.

Decision table that handles error messages

Configure decision table to handle data source errors

  1. Based on the decision table, perform the error handling action for the data source in the MyCoErrorHandlerMaster data transform.
    Set error handling steps in the data transform
  2. In the MyCoErrorHandlerMaster data transform, create and call a decision table to map user-friendly error messages instead of the default error messages, as shown in the following figure:

Decision table to trigger user friendly messages

Configuring decision table to send user-friendly messages

This data transform can now be used 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.
Using error handling data transform in an activity data source

In use cases that require a manual retry during data page error, consider using the hasNoMessages when condition with Do not reload when in the data page rule form so that the data page is reloaded on retry whenever there is a data page error.

Configuring data page to manually retry on error

Handle other invocation errors procedurally in flows, post-flow action processing, or activities, as appropriate for the specific requirement.

Debugging tips

  • To trace Data Page and Data Transform rules, open the Tracer tool directly from the rule form

Launching the Tracer tool from data page

Launching tracer from rule form

  • To trace date pages that are loaded asynchronously, open the Tracer tool from the Data Page rule.

50% found this useful


Related Content

Have a question? Get answers now.

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