Leave Request Approval Flow in Power Automate

Loading

Requirement: Creating a Leave Request Approval Flow using SharePoint, Power Apps in Power Automate Flow.

Initially need to create a Sharepoint List which need to connect with Power App to create a flow.

Here the SharePoint list “Leave Request”

Create a Application By using Gallery, Edit form and Display Form.

  • On Gallery the following logics are:
    • Gallery-
      • Items Property:- Sort(Filter(‘Leave Request’,’Created By’.Email= User().Email && Switch(varFilterBy, “Pending”,(Status.Value=”Pending HR Approval”)||(Status.Value=”Pending Manager Approval”),”Approved” ,Status.Value=”Approved”,”Declined”,Status.Value=”Declined”,true)), Modified, SortOrder.Descending)
    • Icon-
      • Icon Property:- If(ThisItem.Status.Value=”Approved”||ThisItem.Status.Value=”Pending HR Approval”,Icon.CheckBadge,If(ThisItem.Status.Value=”Pending Manager Approval”,Icon.QuestionMark,Icon.CancelBadge))
    • Icon2-
      • Icon Property:- If(ThisItem.Status.Value=”Approved”,Icon.CheckBadge,If(ThisItem.Status.Value=”Pending Manager Approval”||ThisItem.Status.Value=”Pending HR Approval”,Icon.QuestionMark,Icon.CancelBadge))
    • All(Button)-
      • OnSelect Property:- UpdateContext({varFilterBy:””})
    • Pending(Button)-
      • OnSelect Property:- UpdateContext({varFilterBy:”Pending”})
    • Approved(Button)-
      • OnSelect Property:- UpdateContext({varFilterBy:”Approved”})
    • Declined(Button)-
      • OnSelect Property:- UpdateContext({varFilterBy:”Declined”})
    • Form-
      • Items Property:- Gallery.Selected
    • Gallery2-
      • Items Property:- Filter(‘Leave Request’,(Status.Value=”Pending manager Approval”&&Manager.Email=User().Email)||(Status.Value=”Pending HR Approval”&&HR.Email=User().Email)||(Status.Value=”InProgress”&&HR.Email=User().Email)||(Status.Value=”InProgress”&&Manager.Email=User().Email))

Create a Automated Flow below following steps

  • Take Trigger as “When an item is created”
  • Add an action Condition action, in this add “Start and wait for an approval manager” on yes condition
  • If Status Value is equal to Pending then send an Approval mail to Manager.

  • Add one more condition on this If Outcome is equal to Approve update the item.
  • One more condition if Status value is equal to Approve then send an email as your leave request is approved

Leave Approval mail for Manager.

  • If the Manager Approves the request then the other mail as shown in below

Leave a Reply

Your email address will not be published. Required fields are marked *