Leave Request Approval Flow Template

Request Manager Approval for Leave Requests Template

In the latest installment of "The More You Know Flow" I will be covering the Request Manager Approval for Leave Requests Flow Template. In my work as a consultant, one of the most consistently requested things I see is to create an automated process for PTO requests. I've built several leave request workflows in our old friend SharePoint Designer back in the B.F days (Before Flow).  Thankfully, Microsoft has realized the need and provided us with an easy to use Flow template for automating the leave request approval process.

Set Up

Before we get started there are a few things we need to understand and set up.

1) This template assumes you have a SharePoint list set up to track Leave Requests.  It uses a new item being added to this SharePoint list as the trigger to kick off the Flow.  I used the Custom List template and just added two date fields for "From" and "To" to mark the dates the person is requesting off.  I added one additional field for "Request Type" that is a choice field with options for PTO, Sick, Jury Duty, etc.  You can customize your list however you like just make sure it's there before you set up the Flow.

2) It is going to look up the manager you have defined in your user profile so if you don't have that defined it won't work.

Configure

First step to create this workflow is to locate the "Request Manager Approval for Leave Requests" Template in Flow:

Figure 1 - Flow Template

Once you select the template you'll be taken to the screen to connect to all the required data sources (Outlook, SharePoint, O365 Users).  Configure your connections and click continue.

As you can see the Flow template is fairly simple:


Figure 2 - Flow Configuration


It's triggering off a new item being added to SharePoint, then it's getting the profile information of the user who submitted the request.  Next, it will look up the manager for that user then it starts the approval process.  That approval process is sending an email to the manager.  Next, it is looking for the response (did they click approve or reject) and sending an approval or rejection notice to the user that requested the time off.

The only thing that you are required to fill out to get started using this template is Site URL and List Name of your Leave Request list in SharePoint in the "When a New Item is Created" Step.  And the "Item Link Description" in the "Start an Approval" Step.

Figure 3 - Item Link Description

For the Item Link Description I'm just taking the Request Type and Start and End Dates from my SharePoint list and using concat to put all those together:

  concat(triggerBody()?['Reason']?['Value'],triggerBody()?['From'],triggerBody()?['To'])

Once you fill out the required information you can save and test your flow.  Here's what the approval email to the manager will look like:

Figure 4 - Approval Email to Manager


Once the manager approves then the user that requested the leave will receive an email that looks like this:

Figure 5 - Approved Notification to Requestor

Further Customization Ideas

As you can see, with just a few clicks you can get a fully functional leave request approval up and going. But the real beauty of these templates in Flow is the fact that they are easily expanded upon.  One thing you'll notice is that the Flow doesn't actually update your item in SharePoint to mark that it has been approved or rejected.  This is something that you could easily add in your Flow by using the "Update Item" function to update a status column in your SharePoint list with the approve or reject response.  The e-mails are configurable as well so if you want to add additional details you can do that.  You can even add in an additional layer of approval, for example, maybe it needs to go to HR after your manager has approved. Just add in another approval action and you're up in going!



Comments