Power Automate Leave Request Approval Example

    In this Power Automate tutorial, we will see how to create a Leave request workflow in Power Automate. I will share a complete example of the Power Automate leave request approval flow.

    Also, in this Power Automate flow, we have added functionalities like

    • 2 levels of approvals i.e. Team lead and Manager Approvals
    • half-day calculation
    • It will calculate the total leave for business days without including Weekends.
    • Also, it will calculate the Remaining Total leave.

    You can also download the complete flow, the link is available down.

    To create this flow in Power Automate, we need to create 2 SharePoint lists first. These are

    • Employee Leave Request: This Sharepoint list contains all the information related to employee leave. This list contains the following columns:
      • Title-Single Line of Text
      • Employee Name- Person
      • Department-Choice
      • Email address-Single Line of Text
      • Phone number-Number
      • Types of leave-Choice
      • Start date -Date/Time
      • End date-Date Time
      • Half day-Yes/No
      • Number of Days-Number
      • Reason for Leave-Multiple Lines of Text
      • Manager-Person
      • Manager Comment-Multiple Lines of Text
      • Team Lead-Person
      • Team Lead Comment-Multiple Lines of Text
      • Approval Status-Choice
    power automate leave request
    • Total Leave: This list contains the Employee’s name, the Total leave assigned by the organization, and the Remaining leave that the employee holds. This list contains the following columns:
      • Title-Single line of text
      • Employee Name- Person
      • Total leave-Number
      • Remaining Leave-Number
    Power automate employee leave request

    When an employee requests a leave ‘Employee leave request list’ then we perform the below tasks:

    • First, we get the remaining leave from the Total leave list, for that particular employee.
    • Then we will calculate the total leave requested by the Employee, by using the Start date and End date of Leave. Also, we will exclude the Weekends from the total leave, if it’s available.
    • Then we will check whether the employee’s Total leave contains half a day or not.
    • If half a day contains, we will subtract 0.5 from the Total leave(requested by the employee)
    • Then we will send an Approval to Team Lead, if it is approved we will send the request to Manager. If the manager approves, then we will send an email to the Employee that the leave is Approved.
    • Also, we will update the Number of days left, Manager comments, Team Lead comments, and the Approval status in the Employee Leave request list in SharePoint. Also, update the Remaining days left in the Total leave list.
    • If not Approved, we will send an email to the employee, your leave request is rejected and update the Approval status.
    • Let’s say the employee does not apply for half-day, in that case, we will follow the same approval process and update the items in the SharePoint list.

    This is an overview of the flow in Power Automate

    multi level approval workflow power automate

    How to create Leave Request Approval in Power Automate

    Here, we will see how to create a leave request approval flow in Power Automate.

    Before starting to create the flow in Power Automate, make sure you have set up both the SharePoint list, as shown above

    1. Open Power Automate Cloud and click on + Create -> select Automated Cloud Flow.

    Microsoft power automate leave request

    Then, provide the flow name and select When an item is created action. Then click on the Create button.

    Microsoft power automate leave request workflow

    Now you can see When an item is created action is added to the flow page. Then, provide the flow information:

    • Site address: Provide the SharePoint site address
    • List name: provide the SharePoint list name
    power automate leave request workflow

    2. Next, we will get the remaining leave; for this, click on Add an action -> select Get items action. Then provide the information below

    • Site address: Provide the SharePoint site address
    • List name: provide the SharePoint list name
    • Filter query: Provide the below query.
    EmployeeName/EMail eq '@{triggerOutputs()?['body/EmployeeName/Email']}'
    power automate vacation request

    3. We need to initialize the variable like below, for this, select the initialize variable action.

    NameTypeValue
    Start dateString@{triggerOutputs()?[‘body/StartDate’]}
    End dateStringaddDays(triggerOutputs()?[‘body/EndDate’],1)
    Remaining LeaveFloat
    Weekend ListString
    CounterWeekendInteger
    CounterWeekdaysInteger
    CounterStartDateString
    Microsoft power automate vacation request

    4. Next, we will calculate the Business days from the Start date and End date; for this, click on +New step -> select Do until action. Then provide the below information:

    • Choose a value: Select the Start date variable
    • Operator: is greater than or equal to
    • Choose a value: Select the End date variable
    Microsoft power automate vacation request workflow

    5. Now we will check if the date is Saturday or Sunday; click on Add an action, inside Do until action. then provide the information below:

    • Choose a value: Provide the expression
    dayOfWeek(variables('Start date'))
    • Operator: is equal to
    • Choose a value: Write 6

    Then click on +Add -> select Add row -> Change the operator And to Or

    • Choose a value: provide the expression
    dayOfWeek(variables('Start date'))
    • Operator: is equal to
    • Choose a value: Write 0
    request manager approval for leave requests Power Automate

    6. Now, in the If yes part of the condition, we will Append the date as are weekends and count the weekend. For this, click on Add an action, and select Append to String variable action. Then, provide the below information.

    • Name: Select Increment
    • Value: Select the Start date variable

    Now we will increment the variable; for this, click on Add an action, and select Increment variable action. Provide the information below:

    • Name: Select the CountWeekend variable
    • Value: Provide 1.
    request manager approval for leave requests Microsoft Power Automate

    7. In the If no part of the condition, click on Add an action -> select Increment variable action. Provide the following:

    • Name: Select CountWeekdays variable
    • Value: Provide value as 1.
    request manager approval for leave requests in Microsoft Power Automate

    8. Outside the Condition Control, we will set the start date; for this, click on Add an action and select Set variable action. Provide the below information:

    • Name: Select the CounterStartDate variable.
    • Value: Provide the below expression:
    addDays(variables('Start date'), 1)

    Next, we will assign the above variable to the start date variable; for this, click on Add an action -> select Set variable action. Then provide the below information:

    • Name: Select the name as StartDate
    • Value: Select the value as CounterStartDate.
    request manager approval for leave requests in Power Automate

    9. Now we will check whether the user selected half day or not; for this, click on +New step -> select Condition action. Then provide the below information:

    • Choose a value: Select Half day from dynamic content
    • Operator: is equal to
    • Choose a value: Provide the expression:
    True()
     leave request in power automate

    10. Now, if the condition is true, then we will calculate the total leave days by subtracting the half day. For this, in If yes part of the condition -> click on Add an action -> select Compose action.

    Provide the below information:

    • Inputs: Provide the below expression:
    sub(variables('CounterWeekdays'),0.5)
    leave request in Microsoft power automate

    11. Next, we will send an approval to the Team lead; for this, click on + New step -> select Start and Wait for an Approval action. Then Provide the information below:

    • Approval type: Select Approval type as Approve/Reject -First to respond
    • Title-Provide the title
    • Assigned to – Provide the Team Lead email from dynamic content
    • Details-Provide the details
    leave request workflow in Microsoft power automate

    12: Next, we will check the Outcome of Approval; for this, click on Add an action and select Condition action. Provide the below information:

    • Choose a value: Select Outcome from dynamic content
    • Operator: is equal to
    • Choose a value: Provide the value as Approve
    leave request workflow in power automate

    13: Once the team lead approves the leave request, we will send the Approval request to the Manager; click on Add an action. Select Start and Wait for an Approval Action. Then Provide the information below:

    • Approval type: Select Approval type as Approve/Reject -First to respond
    • Title-Provide the title
    • Assigned to – Provide the Manger email from dynamic content
    • Details-Provide the details
    How to leave request workflow in Power automate

    14. Next, we will check the outcome of manager approval, for this, click on Add an action -> select Condition action, then provide the below information.

    • Choose a value: Select Outcome from dynamic content
    • Operator: is equal to
    • Choose a value: Write Approve
    How to leave request workflow Power automate

    15. If the condition is true, then we will send an email to the Employee that your leave request is approved. For this, in the IF yes part, click on Add an action -> select Send an email(V2) action. Provide the information below:

    • To: Provide the Employee email
    • Subject: provide the Subject of an email
    • Body: Provide the body of an email
    How to create leave request Power automate

    16. Next, we will update the remaining leave to the Total leave list in Sharepoint. For this, click on Add an action -> select Set variable action. Provide the information below

    • Name: Select the Remaining leave variable.
    • Value: Provide the below expression
    sub(items('Apply_to_each')?['RemainingLeave'],outputs('Compose-total_leave_days'))

    After that, click on Add an action -> select Update item action. Provide the below information:

    • Site address: Provide the Sharepoint site address
    • List name: Provide the SharePoint list name
    • Id: Provide the ID. This will automatically add Apply to each Action.
    • Remaining Leave: Select the Remaining Leave variable
    How to create leave request in Power automate

    17. Then we will update the No of days leave and Team lead and Manager comments; for this, click on Add an action -> select Update item action.

    Provide the below information:

    • Site address: Provide the Sharepoint site address
    • List name: provide the Sharepoint list name
    • Id: Provide the Id
    • Number of Days: Select the output of the compose
    • Manager comments: Select Response comments from dynamic content. This will add Apply to each action automatically.
    • Team Lead Comment: Select Response comments. This will add Apply to each action automatically.
    • Approval Status: Select Approve
    How to create leave request workflow Power automate

    18. If the Team Lead Approved and the Manager doesn’t approve the Leave request, we will update the Approval status as Rejected. Also, we will send an email to employees if the leave request is rejected.

    For this, in the If no part of the condition [Check Manager Approval] click on Add an action -> select Update item action. Then, provide the below information.

    • Site address: Provide the Sharepoint site address
    • List name: provide the Sharepoint list name
    • Id: Provide the Id
    • Number of Days: Select the output of the compose
    • Manager comments: Select Response comments from dynamic content. This will add Apply to each action automatically
    • Team Lead Comment: Select Response comments. This will add Apply to each action Automatically.
    • Approval Status: Select Approve

    Now we will send an email; for this, click on Add an action -> select Send an email (V2) action. Then provide the below information:

    • To: Provide the employee email
    • Subject: provide the Subject of an email
    • Body: Provide the body of an email
    How to do leave request workflow Power automate

    19. Similarly, if the Team lead doesn’t approve the request we will send a rejected email to the employee. Also, we will update the Approval status in the list as rejected.

    How to do leave request workflow Microsoft Power automate

    20. If the employee doesn’t select half day, then in Step 9, the condition becomes false. We will follow the same steps from 11 to 19. While updating the Number of days in the Employee Leave request list, we will choose the CountWeekdays variable.

    Create leave request workflow Microsoft Power automate

    21. Once you have added all the steps, click on Save and run the flow manually. Apply for leave request in the Employee leave request list.

    multi level approval workflow in power automate

    Once all the processes are completed and based on the approval, the item gets updated like below.

    leave request app in Power Automate

    The remaining leave field in the Total leave list gets updated in Power Automate.

    approval of leave application in Power Automate

    Also, employees will get an email like the one below.

    leave request approval email in Power Automate

    This is how we can create an Employee leave request workflow using Power Automate. Also, you can download the complete solution for the leave request approval workflow.

    Conclusion

    In this Power Automate tutorial, we saw how to create an approval flow for leave requests in Power Automate with the below functionalities:

    • 2 levels of approvals i.e., Team lead and Manager Approvals
    • half-day calculation in the flow
    • We calculated the total leave for business days without including Weekends.
    • Calculated balance Total leave.

    You may also like the following tutorials:

    comment_count comments
    Oldest
    Newest
    Oldest

    Comment as a guest:

    >