Here, in this article, we are going to discuss the process of creating an approval workflow. We will work on functionality so that the Approver or Manager can approve and reject the request via email instead to navigate webforms.
Scenario
- Employee raises a leave request.
- The request goes to the employee manager or whoever is assigned as AD or synced with the O365 account.
- Manager can approve or reject the request with comments via email.
- The employee will get notified based on the manager comments.
Prerequisites
- Microsoft Flow.
- A SharePoint Online list.
- Office 365 Outlook and Office 365 Users account.
Let's get started
The overall Microsoft Flow structure will look like this.
Step1
To create a leave request, I am using a List at SharePoint Online. Employee submits a request and the associated MS Flow gets triggered on item creation.
Step 2
Create a string variable as a name Manager (This step can be optional too).
Step 3
Get user manager from O365 profile using "created by"; i.e., who has created the request. User Manager should be assigned at O365 User Profile.
Set Manager email id to the created variable to send the request.
Step 4
Add an action “Start and Wait for an approval”.
Select the approval type: Approve/Reject – First to respond and assign the request to Manager with title and details.
The advantage of this action is that the workflow will not proceed until the manager approves or rejects the workflow via email body button.
Step 5
Check for condition and accordingly, update the manager comments provided in an email to SharePoint Online List.
Step5.1
If Request status is approved, then update the action. The "Send email" section will look like this.
Step5.2
If the Request status is rejected, then update the action. The "Send email" section will look like this.
Now, we will talk about the flow process.
The user creates a request via form (Created a list at SharePoint Online with a required column for demo purpose). Here, I have created the first request.
The designated Microsoft Flow gets triggered and waits until the request is not responding.
Switch to "manage email" box and check for email. Manager will get an approval email.
Approval of request assigned manager can act over a request with approving or rejecting a request with comments.
As approver responded to an email with comment and approved status. The Leave request item will get updated with a response,
The employee gets a final notification along with the approve/reject status.
I hope you have learned something new in this article. Stay tuned for related articles to get more insights and learning.