Configuring error handling for Data Pages
Archived
4 Tasks
30 mins
Intermediate
Pega Platform 8.6
Data Integration
English
Scenario
As part of each candidate case, TGB performs a background check on the applicant. As part of the background check, a SOAP connector is invoked to retrieve a credit report from a credit check provider. If something goes wrong when the SOAP connector is invoked, TGB wants to log errors and display the message Credit Check unavailable: contact your system administrator.
To accomplish this functionality, configure the CreditCheck connector for the D_CreditReport data page, detect errors and invoke a reusable error handling data transform from the response data transform, and verify that all errors are detected and handled in the error handling data transform.
The following table provides the credentials you need to complete the challenge.
Role | User name | Password |
---|---|---|
Senior System Architect | SSA@TGB | rules |
Note: Your practice environment may support the completion of multiple challenges. As a result, the configuration shown in the challenge walkthrough may not match your environment exactly.
Challenge Walkthrough
Detailed Tasks
1 Source the D_CreditReport data page with the CreditCheck connector
-
In the Data Explorer, open the D_CreditReport data page.
- In the Definition tab, in the Data sources section, disable data simulation.
-
Under the Request Data Transform field, click Parameters to verify that Pass current parameter page is selected to ensure that the TIN (Tax identification number) is passed to the request data transform.
- Under the Response Data Transform field, click Parameters to verify that Pass current parameter page is selected to ensure that the Case ID is passed to the response data transform.
-
Save the D_CreditReport data page.
2 Create reusable error handling data transform
-
Open the standard pxErrorHandlingTemplate data transform.
-
Create a copy of the pxErrorHandlingTemplate data transform named ErrorHandlingMaster in the top-level class, TGB.
-
On the Parameters tab, define a parameter named pyCaseID for the case ID.
-
Mark the pyCaseID parameter as required.
- On the Definition tab, right-click step 2, and then select Enable to get messages using the pxGetPageMessages function.
- Right-click step 4, and then select Enable to enable the step to use the pxClearMessages function to clear the messages on the data page before adding your custom error message.
- Right-click step 6, and select Enable to use the pxAddMessageToPage function and add the ErrorMessage input parameter as a message.
- Right-click step 8, and then select Enable to use the pxLogMessage function to write messages in the log file.
- In the Source field of step 8, enter @(Pega-RULES:Default).pxLogMessage(param.getMessage + " for case number " + param.pyCaseID).
Note: You always need to specify a target, even if the function does not return anything or if you are not interested in the response.
-
Save the ErrorHandlingMaster data transform.
3 Configure the CreditCheckResponse data transform with ErrorHandlingMaster
-
From D_CreditReport data page, open the CreditCheckResponse data transform.
-
Right-click step 2 and select Enable to ensure that the pxDataPageHasErrors when rule is invoked to check for errors.
-
Configure the CreditCheckResponse data transform to apply the ErrorHandlingMaster instead of the pxErrorHandling data transform if an error occurs.
-
Click the Gear icon to specify the input parameters for the ErrorHandlingMaster data transform.
-
In the pyCaseID input parameter field, enter param.CaseID.
-
Save the CreditCheckResponse data transform.
4 Configure an error message in UI
-
In the Application Explorer, under the Candidate case type, click User Interface > Section > BackgroundCheck_0 section to open BackgroundCheck_0 section rule.
-
Click Section - Credit report to open the BackgroundCheck_0_CreditReport section rule.
-
On the Template configuration menu, click Add > Data display > Label to append a label to the dynamic Layout.
- In the dynamic layout, click the new label field to configure the cell properties for the new label.
-
Use the following information to complete the General form.
Property Value Value Credit Check unavailable: contact your system administrator Visibility Condition (when rule) Condition for visibilty hasMessages - Save the BackgroundCheck_0_CreditReport section rule.
Confirm your work
Note: Simulation might be enabled if you completed the Configuring data access patterns challenge prior to this challenge. Disable simulation for the CreditCheck connector before you proceed.
- In the User portal, create a Candidate case.
-
Complete the Submission stage.
Note: You can specify any values to complete the steps. They do not impact this challenge. -
In the Conduct phone screen view, click Submit to advance the case to the Approval assignment.
-
In the Approval view, click Approve to advance the case to the Background check assignment.
- To the right of the Background check assignment, click Go to start the Background check.
Note: The SOAP connector in this challenge is configured to always generate an error.
-
The Credit Check unavailable: contact your system administrator message indicates that the system executed the error handling data transform.
-
In Dev Studio, on the Configure menu, click System > Operations > Logs to open the logs of the system.
- Click Log files to open the Logs Files window.
-
Click PegaRULES.log to open the PegaRules log.
-
Scroll through the log file to the end to see more details on the error message.
Tip: To see the error, you can search the log file with Case ID.