In this blog, I will guide you through creating a fully automated Leave Approval Process using Power Automate. This solution ensures smooth communication between employees and their reporting managers or team leaders, with automated notifications and updates.
Overview
This Power Automate flow is triggered when an employee submits a leave request via Microsoft Forms. The flow determines the number of leave days and directs the request to the appropriate approver (Team Leader or Manager) based on predefined conditions. Notifications are sent to both the approver and requester, and the approval status is updated in a central record-keeping system such as an Excel file or SharePoint list.
Steps to Create the Flow
1. Trigger: When a new response is submitted
- Use the Microsoft Forms trigger “When a new response is submitted” to initiate the flow when an employee submits the leave application.
2. Get Response Details
- Add the Get response details connector to retrieve all the submitted data from the Microsoft Form. This ensures that all input fields, such as employee name, leave dates, and reasons for leave, are captured.
3. Convert Leave Days to Number Format
- Add a Compose connector to convert the “Number of Leave Days” field from text to a numerical format using the
int()
function and use Dynamic content ‘No. of Leaves days’ This step ensures that the field can be used in conditional logic.
4. Define Approver Details in JSON Format
- Use a Compose connector to create a JSON object with the following approver details:
{ "TeamLeader": { "Name": "John Doe", "Email": "tl@example.com" }, "Manager": { "Name": "Jane Smith", "Email": "manager@example.com" } }
Replace the sample data with the actual details of your organization’s team leaders and managers.
5. Parse JSON
- Add the Parse JSON connector and configure it to parse the JSON object created in the previous step. This will allow you to dynamically access approver names and email addresses in subsequent steps.
6. Add a Condition to Check Leave Days
- Use a Condition connector to evaluate whether the number of leave days is less than or equal to 2.
- If Yes: The request is sent to the Team Leader for approval.
- If No: The request is sent to the Manager for approval.
7. Start and Wait for Approval
- For both branches of the condition, add the Start and wait for an approval connector and configure it as follows:
- Approval Type: Approve/Reject – First to respond
- Details: Include the employee’s name, leave dates, and reason for leave.
- Recipient: Dynamically assign the Team Leader’s or Manager’s email from the parsed JSON object.
8. Update Approval Status in a Record
- For both branches, add an Update a row (or similar connector, depending on your record-keeping system) to update the approval status and approver comments in the record. Ensure the following fields are updated:
- Approval Status: Approved/Rejected
- Approver Comments: Feedback provided by the approver
- Approver Name: Name of the person who approved or rejected the leave
9. Notify Approver and Requester
- Configure notifications for both the approver and the requester:
- Approver Notifications: Use the Teams and email connectors to notify the approver of the pending request.
- Requester Notifications: Notify the requester of the final decision via Teams and email.
10. Test the Flow
- Thoroughly test the flow by submitting a leave application through Microsoft Forms to ensure the following:
- The flow routes the request to the correct approver based on the number of leave days.
- Notifications are sent as expected.
- The approval status and comments are accurately updated in the record.
Additional Features
- Custom Responses: You can customize the approval notification to include the approver’s comments for better clarity.
- Audit Trail: Use a SharePoint list instead of an Excel file to maintain an audit trail of all leave requests and approvals.
- Escalations: Add a timed condition to escalate the request if the approver does not respond within a specified period.
Conclusion
This automated leave approval process reduces manual intervention, ensures timely approvals, and keeps all stakeholders informed. By leveraging Power Automate’s versatile connectors and dynamic capabilities, you can streamline this crucial HR function and improve employee satisfaction.
Feel free to implement this flow and customize it as per your organizational needs. Let me know in the comments if you have any questions or face any issues!
Vinod Gill
Discover more from Quickinfoz
Subscribe to get the latest posts sent to your email.