Skip to main content

Configuring error handling for Data Pages

Archived

4 Tasks

30 mins

Visible to: All users
Intermediate Pega Platform 8.6 Data Integration English
This content is now archived and is no longer updated. Progress is not calculated. Pega Cloud instances are disabled, and badges are no longer awarded. Click here to continue your progress in the latest version.

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

  1. In the Data Explorer, open the D_CreditReport data page.

  2. In the Definition tab, in the Data sources section, disable data simulation.
    data-sources-check
  3. 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.

    passParams
  4. 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.
  5. Save the D_CreditReport data page.

2 Create reusable error handling data transform

  1. Open the standard pxErrorHandlingTemplate data transform.

  2. Create a copy of the pxErrorHandlingTemplate data transform named ErrorHandlingMaster in the top-level class, TGB.

  3. On the Parameters tab, define a parameter named pyCaseID for the case ID.

  4. Mark the pyCaseID parameter as required.

    pyCaseID
  5. On the Definition tab, right-click step 2, and then select Enable to get messages using the pxGetPageMessages function.
  6. 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.
  7. Right-click step 6, and select Enable to use the pxAddMessageToPage function and add the ErrorMessage input parameter as a message.
  8. Right-click step 8, and then select Enable to use the pxLogMessage function to write messages in the log file.
  9. 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.
  10. Save the ErrorHandlingMaster data transform.

    definitionList

3 Configure the CreditCheckResponse data transform with ErrorHandlingMaster

  1. From D_CreditReport data page, open the CreditCheckResponse data transform.

  2. Right-click step 2 and select Enable to ensure that the pxDataPageHasErrors when rule is invoked to check for errors.

    pxDataPage
  3. Configure the CreditCheckResponse data transform to apply the ErrorHandlingMaster instead of the pxErrorHandling data transform if an error occurs.

  4. Click the Gear icon to specify the input parameters for the ErrorHandlingMaster data transform.

    paramList
  5. In the pyCaseID input parameter field, enter param.CaseID.

    pyCaseIDwithParams
  6. Save the CreditCheckResponse data transform.

4 Configure an error message in UI

  1. In the Application Explorer, under the Candidate case type, click User Interface > Section > BackgroundCheck_0 section to open BackgroundCheck_0 section rule.

  2. Click Section - Credit report to open the BackgroundCheck_0_CreditReport section rule.

    sectionRule
  3. On the Template configuration menu, click Add > Data display > Label to append a label to the dynamic Layout.

    sampleLabel
  4. In the dynamic layout, click the new label field to configure the cell properties for the new label.
  5. 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
  6. 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.
  1. In the User portal, create a Candidate case.
  2. Complete the Submission stage.

    Note: You can specify any values to complete the steps. They do not impact this challenge.
  3. In the Conduct phone screen view, click Submit to advance the case to the Approval assignment.

  4. In the Approval view, click Approve to advance the case to the Background check assignment.

  5. 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.
  6. The Credit Check unavailable: contact your system administrator message indicates that the system executed the error handling data transform.

    errorMessage
  7. In Dev Studio, on the Configure menu, click System > Operations > Logs to open the logs of the system.

  8. Click Log files to open the Logs Files window.
  9. Click PegaRULES.log to open the PegaRules log.

  10. Scroll through the log file to the end to see more details on the error message.

    Error handler message
    Tip: To see the error, you can search the log file with Case ID.


Available in the following mission:

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice