0% found this document useful (0 votes)
53 views23 pages

3 Must Have Work Ows in Microsoft Flow

This workflow allows managers to approve employee holiday requests in Microsoft Flow and SharePoint. When a new holiday request is submitted, the workflow gets the requester's manager, creates a calendar item, and sends an approval request. If approved, it updates the calendar item status and notifies the employee. If rejected, it deletes the calendar item and notifies the employee. The workflow also includes a reminder action to notify managers of pending approvals.

Uploaded by

Chief Mack
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views23 pages

3 Must Have Work Ows in Microsoft Flow

This workflow allows managers to approve employee holiday requests in Microsoft Flow and SharePoint. When a new holiday request is submitted, the workflow gets the requester's manager, creates a calendar item, and sends an approval request. If approved, it updates the calendar item status and notifies the employee. If rejected, it deletes the calendar item and notifies the employee. The workflow also includes a reminder action to notify managers of pending approvals.

Uploaded by

Chief Mack
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

3 Must Have Work ows in

Microsoft Flow
3 Must Have Work ows in Microsoft Flow

Table Of Contents

What we will cover 2


Holiday Approval Work ow 2
Approval Work ow with Reminder 11
Incoming Email to SharePoint Online Work ow 18
About The Speaker 22
3 Must Have Work ows in Microsoft Flow

What we will cover


In this eBook, we will build 3 of the most common and must have work ows, which can be used
in almost any company using MS Flow and SharePoint Online.

As this was from the Flow virtual summit and the basics of Flow were covered in other sessions
from the Summit, we will skip Flow Basics and jump straight into the three work ows.

Holiday Approval Work ow


Why Holiday approval work ow? Because everybody needs time o and it is one of the most
common work ows. This work ow is usually very straight forward with just one approval, and
that is of your Manager. But as a Manager, several questions come to mind

  ho will replace you?


W
 How do I view all my pending requests?
 Do I have enough people working?

So, let’s start by looking at what we need in SharePoint for this work ow.

SharePoint setup
Holiday Request List
We need a custom list in SharePoint which will store all the holiday approval requests that
consists of the following columns.

  itle (Single line of Test)


T
 Start Date (Date)
 End Date (Date)
 Type of Absence (Choice List) Choices
 PTO
 Sick Leave
 Maternity/Paternity
 Other
 Comments (Multiple lines of text)
3 Must Have Work ows in Microsoft Flow

Holiday Calendar
We also need an event list called holiday calendar to show all the leave requests in a calendar
view. We also need to apply an overlay on it so that the approved request will appear in Green
and all the pending ones will appear in purple. This will allow the Manager to view all the
requests and ensure that there are enough people on board to do the work.

That’s all you need in the SharePoint environment, now let’s go to MS Flow and start building
our work ow.

Holiday Approval Flow


Let’s start by adding a trigger; I want my Flow to begin when a new item is created, so we will
use “When an item is created” trigger.

SharePoint Trigger: When an item is created in SharePoint


  ite Address: SharePoint site URL which has the holiday request list
S
 List Name: Holiday Request
3 Must Have Work ows in Microsoft Flow

Of ce 365 Users Action: Get Manager (V2)


Next step is to get the Manager of the user, for that we will use “Get Manager (V2)” action.

User Name: Created by (Email)

Tip: Always rename your actions and triggers based on what they do (something meaningful)
to avoid confusion in future.

SharePoint Action: Create Item (SharePoint)


Next step is to create an item in SharePoint holiday calendar list. For that, we will use the
“Create Item” action from SharePoint.

  ite Address: Same URL as used in the trigger.


S
 List Name: Holiday Calendar

Note: You will not see Holiday Calendar in the drop-down options. So, add it as custom value
“Holiday Calendar”, and then the properties will be auto-populated.
3 Must Have Work ows in Microsoft Flow

We don’t want the title to be the same as what the user entered in the request to keep it
consistent and meaningful. So, let’s set the title value to be user display name and the type of
request and the rest of the settings according to the values below.

  itle: [Created By DisplayName] – [Type of Absence]


T
 Start Date: [Start Date] from Initial Request
 End Date: [End Date] from Initial Request

Approvals Action: Start and wait for an approval


Now, we need to add an approval action to the Flow, which will send an approval request to
the Manager. There are several approval actions available, but for this Flow, we will use “Start
and wait for an approval (V2)” action.

  pproval type: Approve/Reject – everyone must approve


A
 Title: Holiday Approval Request for [Created by (Display Name)]
 Assigned To: [Mail] “from Get Manager” action
 Details: [Created by (Display Name)] requested time o from [Start Date] to [End Date].
Please approve or deny the request.
 Item Link: [Link to Item] “from initial request”
 Item Link Description: See the Request.
3 Must Have Work ows in Microsoft Flow

Advance Settings
Requester: [Created by Email] “from initial request”

Note: If we don’t set the requester, then all the approvals will appear as if they are coming from
the person who created Flow. So it is essential to set the requester to the person who created
the request.

Control Action: Condition


Next step, is to add a “Condition” action which will perform an action based on the outcome of
the approval. So, the condition expression will be [Outcome] is equal to Approve.
3 Must Have Work ows in Microsoft Flow

SharePoint action: Update Item


If the outcome is approved, then we want to update the SharePoint item in the holiday
calendar. We will add the “Update item” action in the “If yes” branch.

  ite Address: Same URL used in trigger


S
 List Name: Holiday Calendar
 Id: [ID] “from Create Item”
 Start Time: [Start Time] “from Create Item”
 End Time: “from Create Item”
 Category Value: Approved.

Of ce 365 Outlook Action: Send an Email


After updating the status of an item in the holiday calendar then, we will send an email to the
requester. So, we will add a “Send an email” action.

  o: [Created by Email] “from initial request”


T
 Subject: Congratulations, your holiday request got approved.
 Body: Enjoy the holiday!-

SharePoint Action: Delete item


In case of rejection, we want to remove the item from the Holiday calendar. So, we will add a
“Delete item” action from SharePoint in the “If no” branch.

  ite URL: Same URL used in trigger


S
 List Name: Holiday Calendar
 Id: ID “from create item”
3 Must Have Work ows in Microsoft Flow

Of ce 365 Outlook Action: Send an Email


Finally, we will send an email to the requester to inform them that their request for holiday
leave is rejected.

  o: [Created by Email] “from initial request”


T
 Subject: Oh no, your holiday request got denied.
 Body: You’re stuck at work this summer!

Run the Flow


Now it’s time to test our Flow and see if it works on the rst attempt. Go to Request Holiday list
in the SharePoint site and create a new item.

First Request Data

  itle: Hawaii
T
 Start Date: 7/8/2019
 End Date: 7/12/2019
 Type of Absence: PTO

Now, let’s create another subsequent request this time make it a Sick Leave so that we can see
them in the Calendar.

Second Request Data

  itle: Hawaii
T
 Start Date: 7/15/2019
 End Date: 7/19/2019
 Type of Absence: Sick Leave
3 Must Have Work ows in Microsoft Flow

Give it a few seconds, and then let’s go to Holiday Calendar and see if the leaves appear in it. If
all goes well, then you should see two new calendar entries for the selected dates.

Now if you Log in as Manager and open email, you should see two emails for leave request
approval. Similarly, if you go to MS Flow, logged in as Manager and go to Approvals, then you
will see two approvals assigned to you.

So far so good; unfortunately, you can’t fool the Manager this time, and so the Manager will
approve the rst leave request but reject the second leave request.
3 Must Have Work ows in Microsoft Flow

Go back to the Holiday Calendar in SharePoint and refresh the page. One of the leave should
turn Green, whereas the other one will disappear.

If you go back to MS Flow and open the Holiday Approval Flow, you will see both previous runs
were successful.
3 Must Have Work ows in Microsoft Flow

Approval Work ow with Reminder


Imagine, as a manager, you get many requests for approval every day, and sometimes you
forget to complete some of them. In this work ow, we will see how we can send a reminder to
approvers about their pending approval tasks. We will use the same SharePoint site we used in
our previous Flow, but we will use a di erent list. For this Flow, we will use the Documents
document library.

SharePoint Trigger: When a le is created


We will start our Flow by adding a trigger, and we will use when a new le is created from
SharePoint in our “Documents” document library.

  ite Address: SharePoint site address


S
 Library Name: Documents

Of ce 365 Users Action: Get Manager (V2)


Next step is to get the Manager of the user who created the le by using the “Get Manager
(V2)” action.

User: Created By Email

Variables Action: Initialize Variable


Next, we will initialize a variable to store the value of approval outcome, whether it’s approved
or rejected.

  ame: Collab365Approved
N
 Type: Boolean
 Value: 0
3 Must Have Work ows in Microsoft Flow

Parallel: Approval process and Email Reminder


Now, it's time to start the approval process and at the same time, check the status of approval
and if not complete, then send an email reminder. We will add a Start and wait for an Approval
(V2) action rst and then right before that, click on the plus sign and add a parallel branch.

The Approval action will be in the left branch by default, and in the right branch, we will add a
do until action. Your Flow should look like this,

Approvals Action: Start and Wait for an Approval (V2)


Now, let’s start by setting up the left branch rst beginning with the approval action.

  pproval Type: Approve/Reject – Everyone must response


A
 Title: Please approve document Titled: [title] “from created le”
 Assigned To: [Mail] “from Get Manager”
 Item link: [Link to item] “from created le”
 Item link description: See the document
3 Must Have Work ows in Microsoft Flow

After the approval is done, we will set the variable Collab365Approved to “true”.

Variables Action: Set Variable


  ame: Collab365Approved
N
 Value: 1
 The left branch should look like this
3 Must Have Work ows in Microsoft Flow

Control Action: Do Until


Now, in the do until action, we will check if the approval has been completed and send an email
reminder if Approval is pending, i.e. Collab365Approved “is equal to” 1.

A quick recap of the ow

“So far, we started an approval process, and now we wait until the approval is completed by
checking the value of this variable. Inside the body of do-until, we will de ne the actions to run
while the approval is pending.”

Schedule Action: Delay


Next step is to set a delay to de ne the frequency of how often the do-until activity should be
executed. For this Flow, we will set the delay to 1 minute, but this is highly not recommended
for the production environment.

  ount: 1
C
 Unit: Minute
Note: For the production work ow, it should be at least 1 day.

Send a Reminder Email based on condition


Now, it’s time to de ne what to do after the delay, and here we will use a condition action to
check if the approval is still not completed by using the same variable.

Condition

Collab365Approved “is equal to” 0

If Yes

Send a Reminder if not Approved


3 Must Have Work ows in Microsoft Flow

So, if the approval action is still not complete, then we will send an email to the Manager for a
reminder.

  o: Mail “from Get Manager (V2)”


T
 Subject: Approval Pending
 Body: You have an approval pending! Please see all your pending approvals in the Flow
approvals.
3 Must Have Work ows in Microsoft Flow

Send an Email to Creator


Similarly, we will also use a condition to check if the approval is completed by checking the
outcome value.

Condition

Outcome “is equal to” Approve

If Yes, then we will send an email to le creator that le has been approved.

  o: Created by Email
T
 Subject: Your document has been approved.
 Body: Good Job

If No, then we will send an email to le creator that le has been rejected.

  o: Created by Email
T
 Subject: Your document got denied.
 Body: Come see me in my o ce.

That’s all, and this is what the completed Flow should look like.
3 Must Have Work ows in Microsoft Flow

Run the Flow


Now, let’s run the Flow and see if it works. Go to the SharePoint library and upload a new le in
the “Documents” library. Once done now go to your Flow and open the last run.

The work ow should be running and waiting for the approval. Let’s wait for a few minutes and
then go to the Manager mailbox and see if we have got any reminder emails. You should see a
few reminder emails in the inbox.

Let’s go to the Approvals in Flow and approve the task. Once the approval task is complete, the
initiator will receive an email that the document is approved.
3 Must Have Work ows in Microsoft Flow

Wait for a few minutes, then refresh the Flow again and the entire Flow should be completed.
This is a great example to show how we can send reminders to users for their pending tasks.

Incoming Email to SharePoint Online Work ow


Sending les in incoming emails directly to a document library is a feature that exists out of the
box in SharePoint On-Premise, but we don’t have this functionality in SharePoint Online.
However, thanks to MS Flow, we can achieve this functionality in SharePoint Online as well. So,
let’s start creating a ow and rst o de ne our trigger.

Of ce 365 Outlook Trigger: When a new email arrives in a shared mailbox


For this Flow, I will use a shared mailbox trigger called “When a new email arrives in the shared
mailbox”. First o , you need to choose a shared mailbox on which you have rights.

  ailbox Address: “HR Documents”


M
 Folder: Inbox
Note: Keep the “Has Attachment” setting to No, otherwise Flow will look for attachments in
every email which can cause a decline in performance.
3 Must Have Work ows in Microsoft Flow

SharePoint Action: Create File


Next step is to create a le in the document library, and for that, we will add a Create File action
to the Flow.

  ite Address: “Site where you want to store email”


S
 Folder Path: HR Documents
 Filename: Attachment Name “From trigger”

Note: Once you add that, you will see Flow will automatically put this action inside Apply to
each. That’s because Flow predicts that there might be more than one attachment since
multiple attachments are allowed.

File Content: Attachment Content


3 Must Have Work ows in Microsoft Flow

We are going to keep it very simple. However, you can use di erent settings and even set
metadata for the le, but for this demo, this is all that we are going to con gure.

Run the Flow


To trigger our ow let's create a new email and send it to the shared mailbox which you have
selected in the trigger. Let’s attach a couple of les to it as well to make sure apply to each
works as expected.
3 Must Have Work ows in Microsoft Flow

Now, let’s go back to our Flow, and it usually takes a few minutes for the Flow to run depending
on how soon the Mail gets delivered and which Flow plan you have subscribed. Once the Flow
runs successfully, you can see by expending the Apply to each that it created two les since we
have two attachment in the SharePoint Library.

Note: You can also use a personal mailbox as well instead of a shared mailbox.
3 Must Have Work ows in Microsoft Flow

About The Speaker

Vlad Catrinescu is a SharePoint and O ce 365 Consultant specializing in SharePoint and


SharePoint Online deployments as well as hybrid scenarios. As a Pluralsight Author, Microsoft
Certi ed Trainer and recognized international speaker, Vlad has helped thousands of users
and IT Pros across the globe to better understand and to get the most out of SharePoint. 

Vlad is also a Microsoft Most Valuable Professional (MVP) in SharePoint since 2013 and has his
own blog at www.absolute-sharepoint.com and he often shares his knowledge by speaking at
local conferences and community events. Vlad also blogs at CMSWire as well as
Computerworld and is often featured in other Microsoft sites such as Redmond Channel
Partner.

You might also like