Continuing our previous basic approval flow, here we’d update it to send an approval request to the manager of the user.
First, we’d use the Get manager V2 action to get the user’s manager.
Let us first update the profiles of the users to add their manager.
Sign in to the Azure portal as an administrator and select Users inside Azure Active Directory.
Here we have specified test user 2 as manager of user 1.
Let us now update our flow, add a Get a record action to get the email of the owner of the case record which will be used later to get the user’s manager.
Here in Item Id, we are passing Owner, it could well be created by or modified by as well.
In the select query, we are specifying the internal email address i.e. primary email address of the user.
Now for the If Yes step, we have used the Get manager action, and have specified the primary email address fetched earlier.
The Mail returned by the Get manager action is used for Assigned to field inside Start and wait for an approval action.
Based on the outcome of approval we are then updating the case record.
This is how the flow looks like
On running the flow, we can see the user’s manager email address in the output for the Get manager V2 action.
We can see the manager of the user 1 getting the approval request.
Now instead of the manager specified in User’s profile in Office 365 (Azure AD), let us update the flow to send an approval request to the User’s manager (system user) inside Dynamics 365.
Let us update the flow,
in the Get a record action instead of fetching the primary email address (internal email address) of the owner, we’d use Expand Query to fetch the primary email address of the Manager specified in the Owner (system user) record.
Create the query with link entity in our favorite FetchXML Builder and click on Power Automate Parameters
Copy the Expand query.
Paste it in the Expand Query of the Get a record action.
Remove Get manager (V2) 2 action from If Yes step, as we already have the email address of the manager now and specify the same in the Start and wait for an approval action’s Assigned to field.
Save and Test the flow.
Here we can see the test user 2 who is the manager of user 1 receiving the approval request.
We can the manager’s email in the output for Start and wait for an
Thus, we see a couple of ways to implement Manger’s approval, we’d look at a few more scenarios in the next posts.
Do check out the wonderful training on Approvals in Power Automate
Hope it helps..