Skip to main content

Extending published Application Assets 

4 Tasks

30 mins

Pega Robotic Automation R25
Visible to: All users Applies to: Pega Robotic Automation R25
Intermediate
Robotic Process Automation
English

Scenario

You are a Robotics software development team member currently working on an application asset dedicated to the Pega Finance application. Your task is to update the Finance Asset project with a new helper method, which translates the two-letter state abbreviations to the state names for the Add Customer form, which is required when adding a new customer. 

You were provided with the application documentation and project documentation that states the following:  

  • To access the application, open the following link: https://roboticstraining.pega.com/
  • Use the following credentials to log in to the Finance application:
    User name Password
    pega pega
  • The Add Customer form requires a full state name to successfully add a customer.
  • The provided file contains a dictionary of state names and their abbreviations used in the application method:

 

Complete the following tasks: 

  • Create the private application method framework with output and input parameters. The method should have a String input parameter representing the state abbreviation and a String output parameter representing the full state name. It should also contain output parameters consistent with the application asset implementation for error handling.
  • Update the application method with basic checks for the input parameter. Use the Toolbox methods to check if the input parameter is two digits long. Optionally, check if the input parameter consists of upper-case characters only.
  • Create a lookup table component that includes state abbreviations and their corresponding state names. Since the method you create will serve as a helper, add the lookup table component to the Asset globals.
  • Update the abbrToState application method to utilize the global lookup table for translating the state abbreviations. First, add the dictionary text file provided in the scenario to the Miscellaneous folder within your project. Use the Toolbox methods to obtain the file path and import the text file into the lookup table component. Finally, utilize the lookup table's method to perform the conversion.

 

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

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

Challenge Walkthrough

Detailed Tasks

1 Create a lookup table containing state abbreviations and corresponding state names

  1. In the File Explorer open the Pega Robot Studio installation folder, and then navigate to Extra Resources\Sample automation projects.
  2. Copy and unzip the Finance Asset Project to the desktop folder.
  3. Open the project in Pega Robot Studio.
  4. Click the Finance tab, and then switch to the Interface tab.
  5. On the Interface tab, click Asset globals.
    The Asset globals button on the Interface tab of the application asset.
  6. On the Asset globals, in the Toolbox search field, enter LookupTable.
  7. Drag the LookupTable component to the globals.
    The lookup table component added to the asset globals.
  8. In the property grid, update the Name property to StateAbbreviations.
  9. In the property grid, click the More icon on the Fields property to open the LookupField Collection Editor.
    The property grid of the lookup table.
  10. In the LookupField Collection Editor, click the Add icon to add the following fields to the lookup table: 
    AutoIncrement FieldName Key Type
    False Abbreviation True System.String
    False State False System.String
  11. In the Collection Editor, click OK to finish editing.
  12. On the toolbar, click Save to save the project.

2 Create the application method framework with output and input parameters

  1. In Project Explorer, click and open the Finance application.
  2. Click the Interface tab.
  3. In the Methods section, click the + icon to add a new method.
    The Interface tab of application with the + icon used for adding a new application method.
  4. In the Add new application method dialog box, name the abbrToStateName method, and then clear the Empty automation checkbox. 
    The Add new application dialog box with the application name and Empty automation checkbox cleared.
  5. Click Add to create a new application method.
  6. In the Entry Point, use the + icon to add the String parameter named StateAbbr.
  7. In the ExitPoint design block, use the + icon to add the String parameter named State.
  8. In the Exit design block, use the + icon to add the String parameter named State, and then connect the data output to the corresponding parameter of the ExitPoint.
  9. On the design surface, connect the links as shown in the following figure:
    The automation framework containing the entry and exit point, exit label, and the input and output parameters.
  10. On the toolbar, click Save to save the automation. 
Note: For this project, the abbrToStateName method is a helper method that only the application asset uses, so its visibility type should be Private.

3 Update the application method with basic checks for the input parameter

  1. Add the following design blocks to the abbrToStateName automation surface to check if the input parameter is two digits long:
    Design block name Location Connections

    Length method  

    Toolbox > Data handling > Strings > Status

    Automation link: Entry point - Length method

    Data link: StateAbbr - stringValue

    Equals component 

    Toolbox > Workflow > Decisions

    Parameter value: 2
    Automation link: Length method - Equals component

    Convert abbreviation label 

    Context menu > Add > Label  

    JumpTo Convert abbreviation 

    Context menu > Jump To > Convert abbreviation Automation link: Equals component > Jump To Convert abbreviation
  2.  In the Jump To Error design block, click Enter error message, and then enter Invalid abbreviation length.
  3. On the automation surface, connect the design blocks as shown in the following figure:
    Automation surface containing design blocks for validating input parameters.
  4. On the toolbar, click Save to save the automation. 
  5. Optional: Update the application method with additional input parameter checks.

After running tests on the application assets, the Quality Assurance team pointed out the following scenarios: 

  • Check if the state abbreviation contains letters only, 

  • Check if the state abbreviation contains capital letters only.

Use the existing methods from the Toolbox to fulfill the requirements.  

4 Update the abbrToState application method to use the asset global lookup table to translate the abbreviation

  1. Download the States.zip file, unzip the contents of the States.zip file, and place them in your project’s Miscellaneous Files folder.’
  2. In Pega Robot Studio, click and open the Finance.abbrToStateName tab.
  3. Add the following design blocks to the automation surface to determine the path of the dictionary file:
    Design block name Location/Parameters Connections

    GetProjectPath method

    Toolbox > Runtime > Runtime Automation link: Convert abbreviation label - GetProjectPath method

    GetParentDirectory method 

    Toolbox > Data handling > Files > Path Automation link: GetProjectPath > Result - GetParentDirectory method

    CombinePaths method 

    Toolbox > Data handling > Files > Path

    Parameter value: paths1 = Miscellaneous Files\States.txt

    Automation link: GetParentDirectory method - CombinePaths method

    Data link: GetParentDirectory > Result - CombinePaths method


     
  4. Add the following design blocks to import the dictionary file to the lookup table and retrieve the record from it:
     
    Note: If the Asset globals section is not available in Palette, close and reopen the application method tab.
    Design block name Location Connections

    ImportDelimitedFile method 

    Palette > Asset globals > StateAbbreviations

    Parameters value:
    delimiter = Comma 
    mappingMethod = UseColumnIndex

    Automation link: CombinePaths method - ImportDelimitedFile method

    Data link: CombinePaths > ResultImportDelimitedFile > filePath 

    GetRecord method Palette > Asset globals > StateAbbreviations

    Automation link: ImportDelimitedFile > Result > TrueGetRecord

    Automation link: GetRecord > Result > TrueJump To Exit

    Data link: GetRecord > StateJump To Exit > State 

    StateAbbr property 

    Palette > Locals > Run

    Data link: StateAbbrGetRecord > Key_Abbreviation 

  5. Add the following design blocks for error handling:
     

    Design block name Location/Parameters Connections

    Jump To Error 

    Context menu > Jump To > Error

    Automation link: ImportDelimitedFile > Result > FalseJump To Error 

     

    Data link: ImportDelimitedFile > messageJump To Error > errMessage 

    Jump To Error 

    Context menu > Jump To > Error

    Parameter value: errMessage = Failed to get data from the lookup table

    Automation link: GetRecord > Result > FalseJump To Error 


     
  6. Validate the design blocks and connections with the following figure:
    The full automation with links and parameters.
  7. On the toolbar, click Save to save the automation.

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