Error detection configuration
Error detection configuration
The way errors are detected depends on how the connector is invoked. Connectors can be invoked by data pages or activities. When data pages and activities invoke a connector, the best practices are to:
- Add error detection to all data pages and activities
- Invoke a reusable data transform to handle errors
Pega provides a template data transform called pxErrorHandlingTemplate. This can be used to create a reusable error handling data transform. The error handler data transform can be used with both data pages and activities. The pxErrorHandlingTemplate data transform is in the base class and is shipped as part of the product.
In addition, each connector has an error handling flow. Pega automatically invokes the error handler flow if the error is not detected by another mechanism.
Data pages
Connectors are used with data pages to read data — such as customer and insurance policy data — from an external system. Data pages are loaded on demand. All data source errors must be handled as part of the data page load mechanism. The type of data source being leveraged to load the data page affects how errors are detected and handled.
- Connectors, report definitions, and lookups use the response data transform to detect errors.
- Activities use a transition condition in the activity step to detect errors.
The response data transform is invoked after the connector call is complete. If there is an issue, messages are added.
In your response data transform, use a when condition to check for any error messages on the page. If an error has occurred, apply the reusable error handling data transform.
Activities
Connectors are used with activities to write data to external systems. For example, a connector may be used to update data in a system of record. When the connector is invoked from an activity, use a transition condition to check for the presence of an error in the activity step invoking the connector. If an error is detected, apply the reusable error handling data transform.
Error handling flow
The error handling flow feature detects errors that are not detected in a data page or an activity. This feature is always enabled.
The error handler flow allows you to implement a process for handling the error. It is typically used when the connector response is not required immediately — for example, when updating a legacy system.