Leave Request Approval Flow using Power Automate or Microsoft Flow

Want to build a leave request approval flow? Check out this complete tutorial on how to create a leave request approval flow using Microsoft flow or Power automate.

In this Power Automate leave request flow, we will also calculate the balance leaves from the total leaves of an employee in the Power Automate from a SharePoint list.

If you want to try the flow then download from the link below (scroll down towards the end of the post).

Power Automate Leave Request – Requirement

Here is the complete guide for creating a Leave Request Approval in Power Automate. And the requirements are mentioned below:

  • First of all it will be a 2 level leave request approval i.e. once for Manager and anothert for CEO.
  • When an employee submit a leave request, he/she will get a notification for submitting the request successfully. And it will go for an approval from the manager.
  • Then the request will wait for approval from Manger.
  • If the Manger approve or reject the request then it will notify to the applied user and the data with manager’s comments will be updated on SharePoint list.
  • If manager reject the request it will not go for approval from CEO. But if the Manger approve the request then it will go for forther approval from CEO which will be the final approval.
  • Similarly, if the CEO approve the request it will notify the user and data got updated on SharePoint list. Also, the approval status got updated from Pendig to Approved. Till the final approval the staus is shown as “Pending“.
  • After the final approval the total leaves got updated by calculating and deducting the days from the no. of total leave-days.
  • If the CEO rejects the approval then the total leave will not deduct and it will remain same.

Let’s have a look at the step-by-step method to proceed with this flow according to our requirements.

Step-1:

First, we will create 2 lists on our SharePoint Site. One list contains employee names and their total leaves. We named it “Leaves“.

Columns Data Type
EmployeeName Person or Group
TotalLeaves Number
SharePoint list for Leave Request approval in Power Automate
SharePoint list for Leave Request approval in Power Automate

Another list named “Leave Request” contains the details of the leave request of an employee who applied for leave. This list contains columns such as:

Columns Data Type
Title Single line text
Reason Multiple lines of text
Start Date Date and Time
Half Day Yes/No
End Date Date and Time
TotalDays Calculated (calculation based on other columns)
Types of Leaves Choice
Approval Status Choice(Pending, Approved, Rejected)
Manager Person or Group
Manager Comments Single line of text
CEO Person or Group
CEO Comments Single line of text

Here we used a calculated column in SharePoint list named “TotalDays” that will calculate the total leave days from the start date to the end date. For this the formula is:

TotalDays = IF(OR(ISBLANK([Start Date]),ISBLANK([End Date])),"",DATEDIF([Start Date],[End Date],"D"))
Leave Request Approval SharePoint List
Leave Request Approval SharePoint List

Step-3:

Now we will create a flow where all the process goes automatically. First, we will open the Power automate (https://flow.microsoft.com/). Then click on ‘+Create‘ and select ‘Automated cloud flow‘.

leave request approval flow using microsoft flow
create leave request automated flow on Power Automate

Step-4:

Then it will open a page, where we have to give a name to our flow and it will ask us to choose the flow’s trigger. So here we will choose trigger “When an item is created ” and click on Create.

build a leave request approval flow on Microsoft Flow
build a leave request approval flow on Microsoft Flow

Step-5:

After clicking on Create, we can see it will add a trigger on power automated flow. Here we have to add our SharePoint site address and list name.

Leave Request Approval on Power Automate
Leave Request Approval on Power Automate

Step-6:

After then, we will see how to get data for a login user or applied user from the Leaves list. According to that, we can calculate the balance leaves from the total leaves for that particular user.

For this first, we will add the action “initialize variable” to convert the email id into the string.

Leave Request Approval on Microsoft Flow
Leave Request Approval on Microsoft Flow

Again we will add another action to get the data from the leaves SharePoint list and then filter the data from the whole data. For this, we will add “Get items“.

On that action, there is an option as “Filter Query” where we will use the above variable with the below formula, which will filter the data according to who created the item. The expression is:

EmployeeName/EMail eq 'varLoggedinUserEmail'

Then we will add a compose action, in that we will add the output of the get items i.e. Created by email. It refers to the email address of the user who created the item in the SharePoint list.

Power Automate Leave Request Approval
Power Automate Leave Request Approval

Step-7:

In the next step, we will add a compose action to avoid the decimal number and convert the total days into the whole number. For this, we have to add 2 compose actions.

In the first compose we will take “TotalDays” (the calculated column from the Leaves Request SharePoint list) as input.

In the second compose action, we will insert an expression that converts the output of the first compose into an integer. For this, the expression is:

int(outputs('Compose'))
Microsoft Flow Leave Request Approval
Microsoft Flow Leave Request Approval

Step-8:

Now we will see how to update the total leaves after taking the total days of leave.

For this, again we will add compose action to convert the “Total Leaves” as an input and then add another compose action to convert the previous compose’s output into an integer.

To convert into an integer, the expression is:

 int(outputs('Compose_3'))
Leave Request Approval on Power Automate Flow
Leave Request Approval on Power Automate Flow

Step-9:

Then we will add another compose action when we will subtract the ‘Total Days ‘ from ‘Total Leaves’.

For subtracting, the expression is:

sub(outputs('Compose_4'),outputs('Compose_2'))
Leave Request Approval on Power Automate Flow
Leave Request Approval on Power Automate Flow

Then we will add an action “send an email” that will notify the user, that his request has been successfully submitted:

Send an email to the user for leave request
Send an email to the user for a leave request

Note: Here we have used the outputs of Compose 2 as Days. That will show the total days from the start date to the end date.

Step-10:

After getting the successful message, the request will go to the Manager and it will wait for approval. Here if the manager approves or rejects the request, then it will notify the user and the data will update on the SharePoint list with the responses of the Manager.

Also, the request will go for further approval i.e. from the CEO. If the manager rejects the request then it will not go to the CEO’s approval. The Approval status( in Leaves Request ) will update as “Rejected”.

create leave request automated flow on Power Automate
create leave request automated flow on Power Automate

Step-11:

As per our requirements, if the Manager approves the request then it will go for further approval from the CEO which will be the final approval.

On the “If Yes” section, again we will add an action to wait for approval from the CEO, and then the user will get notification about responses from the CEO. Similarly, the data got updated on the SharePoint list.

Leave request automated flow on Microsoft flow
Leave request automated flow on Microsoft flow

Step-12:

Once the request got approved by the CEO, TotalLeaves will deduct according to the requested total days of leaves. Also, it will calculate the Total Leaves and update the rest leaves on SharePoint List(i.e. Leaves). For this, here we will add another action as “Update item“.

Leave request approval on Microsoft flow using SharePoint List
Leave request approval on Microsoft flow using SharePoint List

Here we use the outputs of composing 7 (subtraction of TotalDays from TotalLeaves) that will update on the leaves and show the rest of the balance leaves of the applied use.

Now just save the flow. And we can see the flow is now ready to Run.

Read Power Automate SharePoint Get items filter query contains is not valid

Test the Leave request flow

Let’s have a look at the below implementation. For example, a user adds a leave request on the leaves request list.

Leave request approval example
Leave request approval example

After adding the request, the user will get a success message like the below:

Power Automate for Leave Request Approval example
Power Automate for Leave Request Approval example

We can see, the request is automatically forwarded to the manager. Also, it will ask for Approve or Reject to the manager like below:

power automate leave request
Approval Request from Manager

After approval by the manager, we can see the user will get a notification about it.

request manager approval for leave requests flow
request manager approval for leave requests flow

And the Sharpoint list will update according to the Manager’s response.

request manager approval for leave requests flow
Power Automate for Leave Request Approval with example

Similarly, after approval from the Manager, the request will be forwarded to the CEO automatically for final approval. The CEO will get an email like the below:

multi level approval workflow in power automate
Example of multilevel Leave request Approval

After approval by the CEO, again the user will get a notification through email about it:

multi level approval workflow in power automate
Example of multilevel Leave request Approval

Now we can see the Approval status got updated from Pending to Approved. Also, the CEO Comments column got updated.

Multilevel Leave request approval on Power Automate
Multilevel Leave request approval on Power Automate

Also, we can see the TotalLeaves got updated on the Leaves SharePoint list. Before it was 14 but now it will be showing as 11 as it is deducted by 3(Total Days).

microsoft flow approval multiple approvers
Calculate Balance leave on SharePoint list through Power Automate

In this way, we can implement the multi-level Leave request approval on Power Automate flow and can calculate the data on SharePoint List. You can download this flow from here.

Read Power Automate save email attachment to SharePoint

Calculate Half-day in Power Automate leave application

Now we will see how to calculate the Half-day leave on leave request SharePoint list and how to update the total leaves of an employee according to Half-day calculation.

Here is the step-by-step guide to doing this calculation on SharePoint and PowerAutomate flow:

Step-1:

First, we will add a calculated column on our SharePoint list named “Total_Days“. For this, the expression is:

Total_Days=IF([Half Day]=TRUE,TotalDays+0.5,TotalDays)

Here we used “TotalDays” that we have created previously to calculate the total days from start day to end date.

Now we can see when a user applied for a leave including half days then it will appear like this:

Half day leave request on SharePoint list and Power Automate flow
Half-day leave request on SharePoint list and Power Automate flow

Step-2:

Now we will do a Lil modification on our Power Automate flow. Such as we will convert the Total_Days into float type. For this, the expression is:

float(outputs('Compose'))
Half-day leave request on Power Automate Flow
Half-day leave request on Power Automate Flow

Step-3:

Similarly, we will convert the “Total Leaves” into float again. For this, the expression is:

 float(outputs('Compose_3'))
Half-day leave request on Microsoft flow
Half-day leave request on Microsoft flow

Then just save the flow and re-run it again. We can see is the “Total_Days” (new calculated column in Leaves Request) appear like below and here we hid the “Total Days“(the previous calculated column):

Power Automate Leave request flow with Half-day calculation
Power Automate Leave request flow with Half-day calculation

And the “Total_Leaves” (in Leaves list) got updated according to half-day calculation after the final approval:

half day leave request calculation on SharePoint list and Microsoft flow
Half-day leave request calculation on SharePoint list and Microsoft flow

This is how we can calculate the half-day leave request on the Power automate flow and SharePoint list.

Download flow for Leave Request

Download power automate leave request flow and also make sure to create both the SharePoint lists with the required list.

In this flow tutorial, we learned how to create a leave request approval flow using Microsoft flow or Power Automate.

Related Power Automate tutorials:

>