Contact Us 1-800-596-4880

Lab 2: Implementation - Currency Change

Overview:

In this lab we will add some additional steps to change currency to USD.

The currency change (from EUR to USD) will be performed using the Google search engine and Web Automation Action Steps to handle and control objects programmatically within a web-based application.

Prerequisites

Before starting

If you have not completed the previous module/lab then you should import the solution into your RPA Builder to ensure that you begin this lab from the right place.

Importing previous module solution

You should have the Google Drive link sent to you along with the credentials and other workshop material. This drive contains the solution for all Labs. If you do not have access, ask the instructor.

  1. From your Windows VM, download the Module_2_Lab_1_completed.crpa file referred to the solution of the previous lab.

  2. Open RPA Builder and open the project you want to overwrite with the lab solution. Make sure you open YOUR project to avoid overwriting other users' work.

    module2 lab01 repo proc listing
  3. Once opened, click the Import Project option under the File menu:

    module2 lab01 import process
  4. Click Yes in the confirmation dialog; locate your downloaded .crpa file and click Open to import it.

You can now continue with the lab.

Step 1: Perform Currency Change

  1. As noted in the overview, the invoice total to be registed in the legacy app must be in USD whilst the incoming invoice total value comes in EUR. So we need to do a currency change before inserting the data in the legacy app.

    We will use Google’s search engine to get the currency exchange from EUR to USD. And to do so we will leverage the Web Automation capabilities of MuleSoft RPA.

    Drag and drop a new Group and name it as Perform Currency Exchange:

    module2 lab02 006
  2. We will invoke a web page with all needed parameters as follows:

    https://www.google.com/search?q=<value to convert>+eur+to+usd

    so we first need to build such search string. Drag and drop a Combine Strings step and name it as Build URL.

    Use the following pattern as the Pattern:

    and pin the first parameter to Activity Parameters.invoiceTotals

  3. As said, we will use a Web Automation action step for this and, behind the scenes, the action step will use a browser to navigate to our URL. In this lab we are using Chrome.

  4. Drag and drop the action step Web Session (Chrome):

    module2 lab02 dropped websession
  5. Open the Web Session (Chrome) wizard and pin the Initial URL to Build URL.Combined String. Leave the rest of the settings as-is:

    module2 lab02 007

    Click OK to save and close the wizard.

  6. Drag and drop a Get Web Element Text step inside the Web Session (Chrome) step and name it as Change Currency to USD.

    This step allows us to navigate through the HTML DOM object and get the data from one of the elements, without needing to do, for example, an OCR of the data displayed in the browser.

  7. Open the Change Currency to USD wizard and click on the Open Browser Wizard button.

    This will open a browser session where we can navigate to the desired page. Enter the following address into the URL input text box:

    and click the Go button on the right:

    module2 lab02 008
  8. The Google search engine page will get loaded and display the value we need:

    module2 lab02 009

    Navigate with the mouse and move over the value. You will notice a blue square surrounding it. Press F2 in that moment:

    module2 lab02 010
  9. After pressing F2 you should get the Path to the DOM object and some other attributes. Click the Check button on the top right to save the settings:

    module2 lab02 011

    This is how the wizard should look like now:

    module2 lab02 012

    Click OK to save and continue.

  10. The Legacy app accepts the value using . as the decimal separator. It might occur that the data extracted from the web page comes with a , as the separator. Just to make sure the text uses the right separator, we’re going to search and replace any existing , with a .

    Drag and drop a String Operations step and name it as Set right separator and configure it as follows:

    Setting Value

    String operation

    Find and replace text

    Input text (string)

    Change Currency to USD.Element Text

    Find what

    ,

    Replace with

    .

    module2 lab02 021
  11. Finally, save the converted text into the Activity Parameter invoiceTotals

    Drag and drop a new Set Variable step and save the value Set right separator.Result into Activity Parameters.invoiceTotals.

  12. This is how the Extract Data acivity should finally look like:

    module2 lab02 013

Step 2: Test the Extract Data activity (Optional)

As part of this step we will locally execute the Extract Data activity to ensure that everything is working.

  1. Drag and drop a Group step inside the Workflow run succeeded block at the end of the activity and name it Debug Print Result

    module2 lab02 014
  2. Drag and drop a Combine Strings step and name it as Build debug data. Enter the following string as the Pattern:

    Invoice Number: {1}
    Invoice Date: {2}
    Invoice Due date: {3}
    Invoice Purchase Order: {4}
    Invoice Total: {5}
    module2 lab02 015

    and pin the 5 variables accordingly:

    module2 lab02 016

    Click OK to save and close.

  3. Execute the workflow by pressing the Run Workflow button.

    module2 lab02 018
    module2 lab02 019
  4. Once you have this working, right click on the Debug Print Result group and disable it by selecting Disable.

    module2 lab02 020