Microsoft Flow In 10 Days - Day Four - Approval Flow (Sequential And Parallel)

Today, I will be covering the day - 4 topics of MS Flow series. If you have not checked my previous post about Microsoft Flow, I would recommend you to have a look at it. Links to the previous posts are given below.

What I am going to cover

I am writing a series on MS Flow on which I will cover most of the areas in it. This will be a 10 days series.

Sequential Approval Flow

Here, we are going to see how a sequential approval is going to be handled in Flow. Real time scenario would be – Person A wants to take leave and submits a leave request in SharePoint. The request goes to Person B (first level manager) for approval. Now, there would be 2 possibilities. On approval, it goes to Person C (second level manager), else on Rejection - the leave request gets canceled.

If it is approved in the first level, then there lie the same 2 possibilities for the second level manager. I have put a diagram to illustrate.

Microsoft Flow

So, in my environment, this is the hierarchy.

                              Microsoft Flow

I am the person submitting the leave request. Sukumar will be the first level manager and Susmitha will be the second level manager.

Ok, let’s spin up the flow environment.

We have an inbuilt template for the approval flow when a SharePoint item is created in a list.

                              Microsoft Flow

But for our better understanding, I am going to start from the scratch.

Create a flow from the blank. Please refer my previous articles to get the basics of flow creation.

Select SharePoint as the trigger and choose “When an item is created”.

And fill the site address and last name. I have created a “Leave Request” list. To keep it very simple, I have not added any columns other than the default title. So the first step will look like this.

                              Microsoft Flow

Now, we have to get the manager of the person who has submitted the request (item in the list). Now, click on “New Step” and select “Add an action”. On the wizard opened, enter “manager”.

                              Microsoft Flow

Now, select “Office 365 Users Get manager (V2)”. Once you click inside “User (VPN)” text box, the dynamic content pane opens on the right side.

Select “Created By Email” from it.

                              Microsoft Flow

Now, we have to repeat the same step again. Click on the “New step” and click on “Add an action”. Enter the text “Approval” on the opened wizard.

                              Microsoft Flow

Select “Approval” from the options shown. Now select the Action “Approvals – Start an approval”. Now, your screen should be something like this.

                              Microsoft Flow

Now we have to select the approval type. Select “Everyone from the assigned list” (in our case, there will not be any impact on the options). The assigned list indicates the people who are going to be filled in the “Assigned to” column.

Once selected, there will be a set of fields opened below. Enter the “Title” of this Approval. I have given “First Level Approval”.

                              Microsoft Flow

Now, we have to make a minor tweak to get the “Manager” which is mentioned above this action. Click inside “Assigned To”, it opens the Dynamic Content pane on the right.

By default, there will not be any Dynamic outputs available for the “Get Manager” action. We have to click on "See more" to get the Mail property of the manager.

                              Microsoft Flow

It will be a bit down on the list as it is alphabetically arranged, else we can search for it at the top of that pane.

                              Microsoft Flow

The next field “Details” is a markdown supported field.

To understand about the markdown fully, go through this - https://docs.microsoft.com/en-us/flow/approvals-markdown-support.

I am planning to publish a separate article on this later. For our example, I am just gonna type “# My Leave Request”.

Item Link filed will be filled with the “Link to Item” property provided by “When an item is created” action’s metadata.

                              Microsoft Flow

Finally, our approval wizard should be like this.

                              Microsoft Flow

Add a condition to drive the flow based on the Response from the Approver (i.e First Level Manager).

In the Condition wizard, configure like below.

                              Microsoft Flow

Response token is achieved from the metadata provided by the above step. And do mind that the text on the right side of the condition “Approve”.

Now, we have to send the approval result to the person who created the leave request (In this case, it is me).

In the “Yes” block, click on “Add an action” and type “Send an email” and select Office 365 Outlook – Send an email trigger.

In the “To” field, we have to get the “Created by Email” token from property provided by “When an item is created” action’s metadata.

And the Subject and Body fields have to be filled accordingly.

We have to follow the similar steps for the no block. Finally, we will see the figure as,

                              Microsoft Flow

There will not be any further actions on the “no” block. But for the “yes” block, we have to go for another level of the approval process.

Now, we have to get the manager of the person who approved the first level. (i.e) to find Sukumar’s Manager.

Then, we have to repeat the Get Manager step as we did before. And it will result like this.

                              Microsoft Flow

The above mail id will be gotten from the metadata properties shared by the Get manager step.

Now, it is the time to add the second level approval. It will be same as before.
 
                              Microsoft Flow

And the block will be like above. I have added the condition to send out the approval for the leave request.

                              Microsoft Flow 

Follow the above steps based on the figure given above.

Add the Send an email action to both yes and no blocks. You will get like this.

                              Microsoft Flow

And your flow is over and we will have an overall output like this.

                              Microsoft Flow

Now, it is the time to test the Sequential Flow that we created.

I have created an item in the “Leave Request” list.

                              Microsoft Flow

Now, we will check Sukumar’s account to check whether he has got the approval mail as he is my first level manager.

I will show our flow designer and the mail received side by side so that it will be easier to understand.

                              Microsoft Flow

Sukumar clicks on Approve button to approve my request. This should send a confirmation mail to me like below.

                              Microsoft Flow

As the request is approved, it should also trigger an Approve-Reject mail to my second level manager, (here Sumithra). Let’s go and check.

                              Microsoft Flow

Thus, we can conclude, it also works. So, the final thing here would be – On approval, I have to get the final confirmation mail.

Susmitha approves my request and I get the below mail.

                              Microsoft Flow

Thus we have done the sequential flow and tested it, in real time.

Parallel Approval Flow

In a parallel approval workflow, multiple persons are required to approve items such as invoices, purchase orders, vacation requests, etc. Each person's approval is independent of all other approvers.

In my scenario, I have to get approvals from Sukumar and Susmithra parallelly.
 
                              Microsoft Flow

Based on the figure create the flow till there and add an approval block down.

Now, click on the “+” to open a parallel branch by selecting - "Add a parallel branch". Now select "Add an action"

                              Microsoft Flow
 
Eventually, we will get something like this
 
                              Microsoft Flow 

Now, click on the New step below each approval block and add a condition.

As usual, we have given above parameters respectively, if the response is “Approve”, we will send approval mail to the user. So, there will be 2 separate emails coming to me for my leave approval.”

                              Microsoft Flow

This is how ideally a parallel flow will look like. And on each condition branches, we are supposed to send emails accordingly.

Thus we have done parallel flow also.

Important points to consider

  • Each and every approval/rejection will be captured in the SharePoint (item), created by having a few more columns in it. So on, every approval respective columns have to be updated. (Action for that will be – “Update an item” SharePoint)
  • Here we have used Outlook to Approve or Reject the items. We can also use Approval tab in the MS flow environment. Even there is a separate tab for “Approvals” in the mobile app.

Thanks for reading. Please share your comments below. Catch you later on the next part of Flow series.


Similar Articles