How to master workflow approval using Microsoft Power Automate
AlfaPeople |
Dec 02, 2019

How to master workflow approval using Microsoft Power Automate

Different?strokes?for different?folks, this is how I describe Microsoft Power Automate (note: until recently it was known as Microsoft Flow)! I find the product so versatile and can help a wide range of people in so many ways.

Power Automate can connect to many platforms and social media, such as Twitter, to automate and draw statistics (for example, the user information of users with 1 million subscribers) and then send it to the marketing team. It can automate mundane approval tasks and do the job in a click of a button. Moreover, it can summarize responses and send emails at once. The fun part is you can do all of this without any “customization”! This is music to any customer’s ears!

A typical requirement customers had in previous implementations was to perform the workflow review and approval via email and with one click of a button. The only way to satisfy these requirements was to perform some kind of modification. Now with Power Automate these days are (finally) over!

There are three types of Flows: Instant (manual), Automated, and Batch. In this article, I will be focusing on the template which is set to Automated, particularly “Complete Dynamics 365 for Finance and Operations workflow work items (PU29)”.

In this blog I will guide you through the correct setup of a Dynamics 365 workflow and the corresponding workflow in Power Automate.

Dynamics 365 workflow setup

Before starting on the new Flow, you need to identify and set up the required workflows in Dynamics 365. For instance, we will set up a simple workflow “Review project invoice proposals” under Project management and account > Setup > Project management and accounting workflows. Add yourself as the workflow approver using Assignment type “Users”. The Completion policy will default to “All approvers”, switch this to Single approver for testing purposes. Revert this to the correct setting after the testing is completed.

Workflow approval using Microsoft Flow

Workflow approval using Microsoft Flow

Business events

The active workflow setup in Dynamics 365 will appear in the business events catalog found in the systems administration module > Setup > Business events, filter by workflow category. In this form, you will also find the active flows set up within the “Active Events” tab along with the results.

Workflow approval using Microsoft Flow

Power Platform – Automate setup

There are three ways to log in to Power Automate:

    1. Dynamics 365 ? Click the button to open the task pane. Click Apps > All apps or type “Flow” under Search my apps.Workflow approval using Microsoft Flow
    2. Flow app
    3. Office 365 web

Click the Flow tab, click the New button > Create from template to create a new Flow.

Workflow approval using Microsoft Flow

A. When a business event occurs

On the section “When a business event occurs”, you will be prompted to specify three things:

      1. Instance ? define them Dynamics 365 environment. Note that you must select the instance three (3) times in these sections: (1) When a business event occurs, (2) Validate, and (3) Execute action.
      2. Business event ? In this case, we will select “Review project invoice proposals”. Note that the number next to it corresponds to the Dynamics 365 Workflow ID. The below screenshot shows the Project management and accounting workflows. We will use ID 000074 ? Review project invoice proposals.Workflow approval using Microsoft Flow
      3. Legal entity ? specify the legal entity, i.e., USMF.
        Note: The Category field defaults to “Workflow workitem?.

        Workflow approval using Microsoft Flow

B. Validate Workitem

In this section, you need to specify the Instance again. The two other fields defaults, and no changes are needed. This section validates if the workflow workitem exists, or in other words, if a workflow has been submitted and available in the queue.

Workflow approval using Microsoft Flow

C. Condition

In this section, we will define the condition “Yes” or “No” the actions will be dependent on. Everything is pre-defined except for the Instance (environment) on the “execute action” section. Please note that you have the option to update the fields with additional information. An example is to add the Workflow due date on the title field. Supplementary content such as invoice proposal amount, lines, etc. can also be added in the “details section” to provide the approver the additional information on the invoice for easy review and approval.

Workflow approval using Microsoft Flow

Workflow approval using Microsoft Flow

Add dynamic content

Click Add dynamic content on the field where you want more fields to be added. A pop-up screen appears, click “See more” to view additional fields. Select the field(s) to be added. This functionality is very helpful if you want to personalize automated emails.

Workflow approval using Microsoft Flow

Flow checker

If you save the Flow without filling in all the mandatory fields, it will open the Flow checker with errors shown and the mandatory fields will be shown in red box with text indicating that it is required. The user can also manually invoke the “Flow check” button to check the errors before saving.

Workflow approval using Microsoft Flow

Workflow approval using Microsoft Flow

Sharing Flow

By default, the Flow you created will appear in the “My flows” tab. When Flow is shared with other team members by clicking Edit on the Owners section and adding more users. After the changes are saved, the Flow will move from My flows to “Team flows” so don’t be surprised if you will not see it in “My Flows” anymore.

Workflow approval using Microsoft Flow

Workflow approval using Microsoft Flow

Test Flow

When the Flow is executed, it will trigger an email to the approver(s) so they can act on it instantly by clicking the approve or reject button provided via email, through the web application or the Flow app. The data will be sent directly to Dynamics 365, activity, and comments will appear in the Workflow history as if the action was done inside of Dynamics 365.

Quick test and validation if the Flow is correctly setup using the button Test Flow. This is mostly applicable for Flow types “Instant” and “Batch”. There is also an option to re-use the data set from previous runs which is cool!

Workflow approval using Microsoft Flow

Prerequisite: Create a new project invoice proposal. Steps below using a simple Project fee journal:

  1. Log in to USMF legal entity. Go to Project management and accounting module > Projects > All projects.
  2. Select a project with project type “Time and material”.
  3. Go to the Project tab > Journals section, select Fee. Click the New button and click Lines. Enter the Category if not defaulted, Sales price and set Line property to “Billable”.
  4. Click Post. Exit from the fee journal.
  5. On the Projects screen, click Manage tab > New section > Invoice proposal. Make sure that Transaction type = Fee is selected. Select the fee journal posted.
  6. Click Workflow > Submit > Submit. This will create a workflow work item that triggers the Flow to run.

Workflow approval using Microsoft Flow

Test Results

Below shows a sample email with Approve, Reject and Request/Change buttons. When the user hits Approve or Reject, the Comment section shows up where the user can optionally enter any comment on the approval more so on the rejection. Note that if the approver attempts to re-assign and forward the email to another user who is not an approver, that user will not be able to do the approvals since the same permission rule applies as if the user is directly in Dynamics 365.

Approval can be done via email, Flow app, Flow web portal (Action items > Approvals), or directly in Dynamics 365. When looking at the workflow history, the user will not be able to tell in which way the approval/rejection was done. It will show approved or rejected by with comments as if it was all done directly in Dynamics 365.

Workflow approval using Microsoft Flow

Screen grabbed from:

Tips and Tricks:
  • You can search for a Flow template using a keyword, for example, “Finance”. This will filter the records and display only three templates.
  • Make sure you know which version of Dynamics 365 you are using before starting to work on a template, there are few templates that are the same but with different versions.
  • When creating a Flow affecting Dynamics 365, it is best to log in Flow from Dynamics 365. I have encountered instances where Dynamics 365instance is not recognized if logged in from the other methods, not directly from Dynamics 365.
  • On renaming Flow titles, if there are more than one of the same templates with different versions, make sure to retain the version number on the renamed title for easy reference and identification.
  • Use the “Check flow” button to check for errors.

Flow is still a work in process, and Microsoft is making continuous improvements on this app. As of the time of this writing these features were not implemented, here are few of my wish list:

  • Ability to make the Comment field mandatory if action is set to Reject and optional for Approved.
  • Currently, Instance will need to be specified in three sections, (1) When a business event occurs, (2) Validate and (3) Execute action. It would be nice if there was an option for single or multiple instances. This way, if single is selected, you wouldn’t have to enter the instance in all events.
  • In the section “When a business event occurs”, it would be nice if the Legal entity must be entered before the Business event. After a legal entity is specified, the list of business events should only show the ones set up for the legal entity and global events. Currently, the user will need to know the Workflow ID for the selected legal entity if the same workflow is set up in multiple legal entities.
  • Improved Flow checker, currently, not all issues are captured in the Flow checker, and it is hard to determine what is wrong with the Flow setup. I believe MBS will soon release an improved checker in Wave 2.
  • If sharing Flow to other users, there should be the ability to specify access like read-only, admin, etc. Currently, once shared the other user will have the ability to edit the Flow.
  • Edit history, there should be the ability to track changes or a change history tab that will list all the changes and dates. Currently, it will send an email if a change occurs but there is no full overview of all the changes made inside of the app.