Microsoft Flow is general available since October 31, 2016 (https://flow.microsoft.com/en-us/blog/announcing-ga/). So, it’s time for a blog post about it. In this post I want to show you how you can automate simple business processes with the help of Microsoft Flow. I will do this by creating a pretty basic vacation request flow. As I’m a SharePoint Consultant I’ll do this with the help of SharePoint Online.
As there are already a lot of articles about what Microsoft Flow is, I won’t go into detail about this. You can find a very good description in this article: The ultimate introduction to Microsoft Flow and PowerApps!
Microsoft Flow does the same job as something like Zapier or IFTTT. It allows you to react to an event in one service (such as SharePoint online) and do something with the data from that event in another (such as Twitter). E.g. If someone adds a new document to a SharePoint library then send a message to a Slack channel. All this can be done easily with zero coding skills needed.
For my scenario, I’ve created a new site collection called “Vacation requests” based on a team website template. In this site collection, I created a custom list called “Vacation requests” and added the following columns:
As I don’t need the “Title” and the “Approval status” in the request form I decided to hide both columns and to fill them later in the flow. Actually, I wanted to work with a choice column for “Approval status” but the “Update item” action in flow doesn’t support choice columns (Person or Group columns are also not supported in this action).
Creation of the flow
To start with the creation of my flow I only must open the “Vacation request” list and click on “Flow – Create a flow”. The creation of flows is completely integrated into the new modern list design. If you do not already use the modern list design, you can go to https://flow.microsoft.com and start with the creation of the flow there.
By clicking on “Create a flow” a new area appears on the right side of the screen, which offers of a lot of already existing flow templates so it’s no necessary to start completely from scratch.
The trigger for my workflow should be the creation of a new SharePoint list item (a vacation request) and one of the steps in my workflow should be the approval of the vacation request by another person. So instead of creating a completely new flow I’ll start with the second template that is offered to me.
In the first step after clicking on the template I need to sign in to SharePoint Online and Exchange Online.
The result looks like this:
After clicking on “Continue” I’m forwarded to the “Flow Designer”. As I started with a predefined template the designer is already filled with some actions.
In the first step, I want to upgrade the title, so I need an add an action that lets me update a SharePoint item. This can be done by clicking on “Add step”. I can decide whether I want to just add an action or if I want to add a condition, add an apply to each action, add a do until action or if I want to add a scope (to group actions like in Nintex).
By clicking “Add action” I can search the whole flow catalogue for my desired action. The easiest way to do this is by just using the search box. If I type in “SharePoint” I’ll get all SharePoint actions, which are 22 now including triggers.
I’m looking for the “Update item” action so I choose this one:
First I move the action to the top of my flow at the second position, so this is the first action that is processed after the flow has been started.
Afterwards I rename the action so I still understand my flow when I look at it some weeks later (Best practice for Workflow design). I will also do this for other action but won’t describe this every time I do it.
Then I start to configure the action. In the first step, I need to identify the item that should be updated. Therefore, I must enter the “Site url”, the “List name” and the “ID” of the current list item (vacation request).
I enter the “Site url” manually and then chose the “List name” out of a dropdown that shows all lists of the site. In every action, I have the possibility to use variables that have been used or created in other actions by using the “Add dynamic content” section.
So, in the “ID” column I choose the “ID” variable of the “When a new item is created” action, which includes the ID of the current element.
In this case the “Add dynamic content” section is nearly empty. Later, this section includes a lot of variables so it makes sense to use the search box that is offered at the top.
After defining the element I can configure the columns I’d like to update. The title column in my case should have the vacation type as a prefix followed by the ID of the element.
I must “update” mandatory columns that I don’t want to update too at this point, which is annoying and should be changed! For these columns, I just update the columns with the old values, so nothing gets changed.
In the next step, I must configure the “Send approval email” action. In the “To” section I enter the variable “Approver Email” from the “When a new item is created” action.
Furthermore, I also change some other parameters of the email, like the subject and the body, to directly provide more information about the request to the approver.
In the “Send emailScope” action I only change the name, the condition is already configured correct.
In the next steps, I will define what will happen if the vacation request is approved and what will happen if the vacation request is rejected. In both cases, I’d like to send an email to the person that created the vacation request and I want to update the approval status of the vacation request.
For the approved request my email configuration looks like this:
Then I must add a new “Update item” action which I configure like this:
Afterwards I’m doing the same for the case if the request gets rejected, but of course change the email and the approval status to “Rejected”. This is how this part looks after I’m finished.
And this is how my complete flow looks like:
At the end, I change the name of my flow and click on “Update (“Create flow”, if it has not been saved before).
If this has been successful I get the following message:
Demo of the flow
To start the flow, I fill out my vacation request form:
Some seconds after the start the flow sets the title of the element and my desired approval status:
Some more seconds later the person in the approver column gets an email with the possibility to approve or reject the vacation request:
After clicking on Approve the approver directly gets a feedback in the email:
The approval status of the vacation request is now changed to “Approved”:
To keep track of my flows and to change my flow I can go to the “My flows” area by clicking on “See your flows”.
There I get an overview of all my flows, I can turn them on/off, I can delete them and I can change them. Furthermore I can have a look on all running flows and workflows that are already finished. This can be done by clicking on the little information icon.
This page lists all flows including start time, status and duration. Furthermore I also have the chance to filter the flows regarding the status.
By clicking on one of the flows I get a visualisation of the flow in which I can see the single steps of the flow including the status and the duration.
That’s it! I hope you enjoyed the article, feel free to contact me if you have any questions or feedback!