Skip to main content

Challenge

Advanced automation techniques and best practices

5 Tasks

35 mins

Pega Robotic Automation 22.1
Visible to all users
Beginner Pega Robotic Automation 22.1 Robotic Process Automation English

Scenario

While running the Robotic Banking automation, you decide that reorganizing the project will improve efficiency and better align with best practices. Updating the project also allows your team to organize and categorize error messages in preparation for deployment, making error messages easier to track in Production.

Complete the following tasks:

  • Add a Message Manifest to the Robotic Banking project with message definitions that categorizes all error messages
  • Refactor the Pega login and customer search automations into application methods
  • Create an automation to use new application methods and message manifest capabilities​

You must initiate your own Pega instance to complete this Challenge.

Initialization may take up to 5 minutes so please be patient.

Detailed Tasks

1 Add the message manifest

  1. Download and unpack the folder containing the Advance automation techniques zip file and move it to C:\Users\<username>\Documents\Pega Robot Studio\
  2.  Open the RoboticBanking.pegaProject in Pega Robot Studio.
  3. In the project explorer, click the Information icon next to the Robotic Banking to display the properties grid.
    Project properties icon
  4. In the Runtime section, click the More icon to open the Message manifest dialog.
    In the project properties pane, the message manifest menu icon in the Runtime section
  5. In the Message definitions window, click Add and then add the following parameters to a new message definition:

    Variable

    Value

    Code

    PEGA101

    Include code in dialog

    Checked

    Caption

    Pega Finance

    Icon

    Error

    Button

    OK

    Default button

    Button1

    Message

    Application Timeout

  6. In the Edit message definition window, select the Submit button to add the Message manifest definition.
    Add new message manifest definition window
  7. In the Message definitions window, select Actions > Import messages to open the File explorer box.
    Import messages action into the message manifest
  8. In the RobotStudioChallengeAssets folder, select the MessageManifest.csv file and then click Open to load the message definitions into the project.
Note: The MessageManifest.csv file is included in the RobotStudioChallengeAssets folder, which you download when installing Pega Robot Studio. Refer to the fourth task in the Installing Pega Robot Studio challenge for further instructions on how to access the file. 
  1. In the Message definitions window, click Done.
    Message manifest definition window displaying all definitions in the project

2 Edit automations to use the new message manifest

  1. On the automation surface, right-click the Finance_CustomerSearch automation design block and click Open.
  2. Click inside the Jump To Success block and select TRUE to set the value returned from the automation.
  3. Click the inside each of the JumpTo Failure blocks and replace the error text with the matching Message manifest code, as follows

    Old Error

    Message manifest code

    Pega Finance application timeout

    PEGA101

    Record not found

    PEGA104 

     
    Added error codes to JumpTo blocks instead of error messages
  4. On the Success label, click the + to add a parameter.
  5. Click inside the Success block to change the parameter from String to Boolean.
  6. Click inside the new parameter and change the name to result and then connect it to the Success Exit block.
  7. Ensure that the parameters are connected as shown in the following figure:
    Connect the Success and Failure labels to the matching exit points

3 Refactor automations into application methods

  1. In the list of project items, select BillPaySystemDiscount to open the automation.
  2. Hold Ctrl on your keyboard and then select the Finance_Login and the Finance_CustomerSearch design blocks.
  3. Right-click to display the context menu and then click Delete to remove Finance_Login and the Finance_CustomerSearch design blocks from the automation.
    Right-click on select Delete to remove the customer search automation
  4. In the toolbar, click the Include button and unselect the Finance_Login automation to remove the references from the automation.
  5. Repeat step 4 to remove references to the Finance_CustomerSearch automation.
  6. Click Done to save your changes
    Remove login and customer search automation from BillPaySystemDiscount automation
  7. In the toolbar, click the Project tab to open the Project explorer.
  8. Click and drag the Finance_Login automation and place it on top of the Pega Finance application, to add it as an application method
  9. Click and drag the Finance_CustomerSearch automation and add it as an application method. 
  10. Right-click the Finance_CustomerSearch application method, click Rename and change the name to CustomerSearch.
  11. Right-click the Finance_Login application method, click Rename and change the name to Login.
  12. In the list of project items, click the Pega Finance application to open the application in a new tab.
  13. On the palette, in the Application methods and forms section, click the CustomerSearch method.
    Application methods section in ACME Finance application
  14. Click the Visibility type list and then select Public to change the method visibility.
    Visibility options for the ACME Customer search application method
  15. Repeat steps 7-8 to update the Finance_Login visibility setting to Public.
  16. At the top of the toolbar, click Save to save your application changes. 

4 Create a new automation with application methods

  1. In the toolbar, click the Project tab and navigate to the project explorer.
  2. In the toolbar, click Add to create a new automation, and name it Finance_RetrieveCustomerData.
    Adding the new Finance_RetrieveCustomerData automation
  3. In the toolbar, click the Include button to add the Pega Finance application to the automation
  4. Add the following design blocks to the automation surface:

    Design block name

    Actions

    Finance_Login application method

    1. In the palette, click the Pega Finance application and drag it onto the automation surface.
    2. In the Select action dialog box, click More and select Method.
    3. In the Search box, enter Finance_Login.
    4. In the Select action dialog box, click the Add button.

    Finance_CustomerSearch application method

    1. In the palette, click the Pega Finance application and drag it onto the automation surface.
    2. In the Select action dialog box, click More and select Method.
    3. In the Search box, enter Finance_CustomerSearch.
    4. In the Select action dialog box, click the Add button.

    Entry point

    1. Right-click the automation surface and then click Add > Entry Point.
    2. In the Run design block, click the +  icon.
    3. Click String parameter > param1 and then enter accountNumber.

    Exit points

    1. Right-click the automation surface and then click Add > Exit Point.
    2. Click inside each exit point and rename it Success.
    3. On the Success exit point, click the + icon.
    4. Click String parameter > param1 and then enter msg.
    5. Click Result and change the type to Boolean.
    6. Repeat steps a-c to create the Failure exit point. 

    Success label

    1. Right-click the automation surface and then click Add > Label.
    2. Click inside the label and rename it Success.
    3. On the Success label, click the + icon.
    4. Click Boolean parameter > param1 and then enter result.
    5. Connect the result parameter to the result parameter on the Success exit point.

     

    Failure label

    1. Right-click the automation surface and then click Add > Label.
    2. Click inside the label and rename it Failure.
    3. On the Failure label, click the + icon.
    4. Click String parameter > param1 and then enter msg.
    5. Repeat step c to add a Boolean parameter and name it result.
    6. Connect the result parameter to the result parameter on the Failure exit point.
    7. Connect the msg parameter to the msg parameter on the Failure exit point.

    Jump To Success

    1. Right-click the automation surface, and then select Jump To > Success.

    Jump To Failure

    1. Right-click the automation surface, and then select Jump To > SuccessFailure.
  5. Connect the design blocks as shown in the following figure:
    Final image of the Finance_RetrieveCustomerData automation

5 Set up BillPaySystemDiscount to use a new subautomation

  1. Click the Project tab and navigate to the Project explorer
  2. In the project items list, select the BillPaySystemDiscount automation.
  3. In the toolbar, next to Finance_RetrieveCustomerData, click Include > add to add the automation.
    Include Finance_RetrieveCustomerData automation in the BillPaySystemDiscount automation
  4. In the Include in palette window, click Done to return to the automation.
  5. In the palette, click and drag the Finance_RetrieveCustomerData automation onto the automation surface.
  6. In the Select Action window, select the Run method, then click Add to close the window.
  7. In the Toolbox, click Accelerators > MessageManifest
    The ShowMessage option in the MessageMManifest section of the toolbox
  8. In the the Toolbox, in the MessageManifest section, click and drag the ShowMessage block onto the automation surface, after the Finance_RetrieveCustomerData design block.
  9. In the ShowMessage() window, select the first option and then click Submit.
    ShowMessage overload options
  10. On the Run block, click the + symbol to add a new parameter and then enter accountNumber as the name of the new parameter.
  11. Connect the blocks as shown in the figure below:
Added show message design block to display correct message based on error code

Confirm your work

  1. From within the BillPaySystemDiscount automation, right-click on the data link next to the Run block and select Toggle breakpoint.
    Toggle breakpoint on automation link in BillPaySystemDiscount
  2. Right-click the data link from Finance_RetrieveCustomerData to the MessageManifestService and select the Toggle breakpoint.
    Toggle breakpoint next to MessageManifest ShowMessage block
  3. On the toolbar, click the green Test button to begin the automation.
  4. In the accountNumber field, enter 1010101 and press the blue Test button
  5. From the toolbar press Step-over or F10 until the execution stops at the ShowMessage dialog box
  6. From the toolbar, press Step-into or F11 to verify the block contains the error code PEGA104.
  7. From the toolbar, press the green Continue button to verify the new message dialog box displays based on the message manifest code.
    Design block received error message
  8. Press the OK button to close the message box.
    Message box matching the Message manifest code displays
  9. On the testing window, press the Done button to close the testing session.
    Testing window shows testing is complete

This Challenge is to practice what you learned in the following Module:


Available in the following mission:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

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