The default approvals provided through Microsoft Flows doesn't have reminders capability. We do have lots of alternate custom approaches to send reminder emails on our own. In this article will go through a custom approach which has below functionalities
- Reminders to the participants who haven't responded - Crucial, as we don't want to confuse users with reminders who already responded to it.
- Reminders with Respond Link
- Reminders with the default Adaptive card through Teams
We can extend this approach for approvals when it crossed 30 days too.
To identify who already responded to the approval, we are accessing Common Data Service entities. So, we need the Premium connector for CDS actions. Also, the account we use (admin account) should have full access to the CDS Approval entities.
Approach in below steps:
Initialize Variable - to hold Pending Assignees list, used later.
Create an Approval - with custom response options for Approve and Reject as i want all responses from participants.
Then, created a parallel branch for Approvals and reminders.
Wait for an Approval- this action is to hold till approval is complete and perform actions based on output
Email notification- to notify users about completion
Terminate process - As we have it as parallel action, once approval actions are complete, we don't want the other branch (reminder) to run.
On the other parallel branch, Reminder functionality
Delay - used delay action to hold for 3 minutes, we can configure delay until too.
List records - CDS action to list Approval Requests sent for above created approval id. we already know this info, but we need IDs of users as stored in CDS entities.
Select - as the response would have lots of meta data, we just need OwningUserID, using this action we pull required property of all requests. item()?['msdyn_flow_approvalrequestidx_owninguserid']
List records - this action is to list records from Approval Responses entities with the approval id created in start.
Select - to extract OwningUserIDs of all responses received so far.
Filter - Now, we filter users from requests, by excluding responded users. As these are simple arrays, filter action would do, From is 'Select requests', Left of filter is 'Select responses' and to the right is item()
Now we have list of user ids who haven't responded yet. But we need email ids of these users. Below logic is to fetch email ids.
Apply to each - loop through each user from Filter action output array
Get Record - to get user details using the user id
Append to string - we extract user email from above action and append it to the variable created to hold pending approvals
Post your own adaptive card - we send the adaptive card available through create an approval on top to use email id.
This would send the adaptive card to all pending participants through the teams and they can respond directly as in email.
And, as we also have all email ids in the string variable, we use it to send reminder email with Approval link.
All the actions put together, the flow would be as below.