Exercise - Advanced Power Automate Desktop features
In this exercise, you use the web automation to convert the total amount into another currency and then add the new conversion to the Excel document.
Open a new web browser and then open Microsoft Edge by going to
edge://settings/system
, which brings you to the System and performance page. Under the System and performance section, turn off the Continue running background extensions and apps when Microsoft Edge is closed toggle. Then, close all browser tabs and sessions before you proceed.Open the Power Automate for desktop app and then go to the Enter an invoice flow that you previously created. Select the ellipsis (...) menu to the right of the flow title and then select Edit from the options menu. (You can also select the pencil icon to go directly to the editing view for your flow.)
From the tabs in the upper part of the screen, select the Subflows dropdown menu. Select New subflow to create a second subflow for the Enter an invoice flow.
In the Edit subflow dialog, in the Subflow name field, name your new subflow as Currency_Converter and then select Save.
Note
Subflow names can't have spaces. If a space occurs within the name, make sure that you replace the space with an underscore ( _ ).
From the Actions menu to the left of the screen, under the Browser automation folder, double-click the Launch new Microsoft Edge action.
In the Launch new Microsoft Edge dialog, in the Initial URL field, enter the following URL:
https://wise.com/us/currency-converter/
Select Save.
Open a new Microsoft Edge web browser and then go to https://wise.com/us/currency-converter/.
This website is the one that you use to look up real-time currency conversion rates.
Next, we enter the total amount value from the AI Builder model as the US dollar (USD) amount into the website input textbox to look up the converted value.
First, let's locate the UI Element on the webpage. Return to the Enter an invoice flow in Power Automate. Ensure that you're viewing the Currency_Converter subflow. From the Actions pane to the left of the screen, under the Browser automation section, expand the Web form filling subfolder.
From the Web form filling subfolder, drag and drop the Populate text field on web page action to below the first action in the design space pane.
The Web browser instance is already populated with the %Browser% instance.
Identify the textbox UI element on the webpage that takes USD as input. To do so, select the UI element dropdown menu and then select Add UI element.
A small tracking session window appears to capture UI elements. Open the browser webpage, and a red rectangle appears within the webpage while you hover the mouse cursor over different elements. Move the mouse cursor over the text field that contains the USD value and then use the Ctrl + Left click keyboard shortcut to select the element.
In the Text field of the dialog, select the variable {X} icon to the right of the field. In the menu, under the Input/output section, double-click the Amount variable.
Select Save in the lower part of the dialog.
Add another action that sends the previous Total amount input value into the UI element field. From the Actions pane to the left of the screen, expand the Web data extraction subfolder within the Browser automation folder.
Drag and drop the Get details of element on web page action to below the second action in the design space.
In the Get details of element on web page dialog, the %Broswer% value is already used to fill in the Web browser instance field. Select the UI element dropdown menu.
From the UI element dropdown menu, select the Add UI element button.
Return to the web browser where you convert the USD dollar value. Use the same process as before to select the Output value by using the Ctrl + Left click action on the value.
In the Get details of element on web page dialog, double-click the Variables produced value.
Rename the value to ConvertedAmt.
Select Save.
Next, let's remove the dollar symbol from the Input Amount variable.
From the right side of your screen, locate and hover the mouse cursor over the Amount variable within the Input/output variables section.
To the right of the variable name, select the ellipsis (...) menu.
From the options menu, select Edit.
Select the Default value field and then delete only the US dollar ($) symbol to the left of the amount value. Select the Save button when you're finished.
From the upper toolbar, select the Save button to save all your changes.
Now, you test the subflow. While still viewing the Currency_Converter subflow, right-click the first action.
From the options menu, select Run from here.
The automation should run and convert the 500 USD amount (the default amount value) into another currency.
Capture the real-time converted value from the website by going to the Write_notes_into_excel subflow and selecting the tab in the upper part of the screen.
Hover your mouse cursor over and right-click the Write to Excel worksheet action with the Amount value set to column D within the subflow.
From the options menu, select Copy. Then, Paste the new Write to Excel worksheet action below the one in which you copied.
Note
If you did not complete the optional task within the previous exercise, then the newly pasted action will be the last action within the subflow. If you did complete the optional task previously, then there will be an additional action at the bottom of the flow labeled Amount and Column F (similar to what is shown within these images).
Hover your mouse cursor over the new Write to Excel worksheet action and then select the ellipsis (...) to the right. From the options menu, select Edit.
From the Write to Excel worksheet dialog, select the variable {X} icon to the right of the Value to write field.
From the menu, under the Flow variables section, double-click the ConvertedAmt variable that you added previously.
Note
You might need to delete the previous variable within the field to correctly enter the new variable.
Select the Column field, and then enter E as the new column.
For the Row field, leave it set to %FirstFreeRow%.
Select Save in the lower right of the dialog.
Now, let's add the Currency_Converter subflow into the Main flow, before the Write_notes_into_excel subflow. Return to your Main flow by selecting it from the tabs in the upper part of the screen.
From the Actions pane to the left of the screen, within the Flow control folder, drag and drop the Run subflow action into the design space of the Main flow. Place it above the current Run subflow action within the flow.
Note
If you completed the optional task within the previous exercise, then you will place the new Run subflow action below the Display message action and above the current Write_notes_into_excel Run subflow action within the flow.
In the Run subflow dialog, select the Run subflow dropdown menu. From the list, select Currency_Converter.
Select Save.
From the upper toolbar, select the Save button and then wait for the flow to be saved.
Now, you can run the Main flow. From the upper toolbar, select the Run button.
After the flow run completes, an entry will be added to the Excel file as it did in the previous exercise, with an extra cell containing the converted value.
Note
If you completed the optional task within the previous lab, then you will see a text entry for the converted value within the Excel file.