B.3 ‐ Robotic Process Automation Online Workshop ‐ Power Automate desktop flow - dcasota/m365-scripts GitHub Wiki

This is mainly the contents from https://learn.microsoft.com/en-us/training/modules/create-first-desktop-flow-online-workshop/exercise-create-flow.

  1. Login in to you virtual machine where the lab files has been saved. Open a new web browser and then go to https://powerautomate.microsoft.com/. Sign in with your test account, the same one that you used in the previous labs.

  2. Double check that you the development environment is set.

image

  1. Select Solutions from the left menu and then select the + New solution option in the upper part of the screen. Name the new solution e.g. as Invoice processing solution. Select CDS Default Publisher from the Publisher dropdown menu and then select Create.

image

  1. Wait for the solution to be created. You should automatically be taken to the solution that you created when it finishes. At the top of the screen, select the + New dropdown menu. From the + New dropdown menu, select Automation > Desktop flow.

image

  1. In the Build a desktop flow dialog, in the Flow name box, name the new flow as Enter an invoice. Then, select the Launch app button in the lower right of the dialog.

image

  1. If you're presented with a dialog that wants to open Power Automate, select the Always allow checkbox and then select Open Power Automate to open the Power Automate for desktop app.

image

  1. When you're in the Power Automate for desktop app designer, in the search bar in the Actions pane, enter run application and then double-click the Run application action.

image

  1. Within the Run application dialog, for the application path parameter, go to and select the location path of the Contoso Invoicing app under Application path. (This action opens the Contoso Invoicing app when you're running your flow). Usually, you can find this parameter under C:\Program Files (x86)\Contoso, Inc\Contoso Invoicing\LegacyInvoicingApp.exe; however, the path might be different on your computer. Select the Save button in the lower-right corner of the dialog.

image

  1. Now you have one action in your flow that opens the Contoso Invoicing app. You can select the Run button to quickly test your flow. Minimize the Contoso Invoicing app manually and then select Recorder.

image

  1. Reopen the Contoso Invoicing app and then select the Record button from the Recorder dialog. In the Contoso Invoicing application, select Invoices from the left menu.

image

  1. Create a new record by selecting the New record icon from the ribbon in the upper left of the screen.

    Use these sample values to complete the recording (you can also use any arbitrary values):

    Date - Current date
    Account - WingTip Cups
    Contact - [email protected]
    Amount - 00
    Status - Invoiced
    

    Select the Save icon from the ribbon in the upper left of the screen to keep your changes.

    Select the Done button at the bottom of the Recorder and then close the Contoso Invoicing app.

image

  1. Within the Power Automate for desktop app, you can view the recorded script of each step.

image

This sort of UI interaction is very old tecnique. I remember the days of AutoIT, where the same approach of data scraping has been achieved. The cleanup process right after the script creation before stepping ahead is important. For instance, instead of simply starting the application, check if the application is already starting. Also, check in which micro-flow the script step is, by reading the value of a field before entering it. Use a safe-fail approach to make the script more robust.

For example, the content in https://learn.microsoft.com/en-us/training/modules/create-first-desktop-flow-online-workshop/exercise-create-flow shopws up ten steps. In the script recorded I got 12 steps.

Step 1 is the run application, and then, the steps recorded.

image

Select the Save icon in the upper part of the screen to save the desktop flow.

After having mastered your data, save the flow.

Finish the Power Automate application.

For solution comparison purposes, import the solution as described in https://learn.microsoft.com/en-us/training/modules/use-input-output-online-workshop/exercise-import . The lab zip package contains a reference solution which can be imported.

image

After the import, click on the solution on the listing.

image