Hello SharePointers,
I am working on my flow and I see that I am unable to Send approval request to a group in MS flow.
Some Background
It seems that flow will only send approval request emails to an individual user. This case won’t work in the long run, we always need to change the flow and remove and add approvers in Microsoft flow.
Is there a way to skip this process and send approvals to group? To Send approval request to a group in MS flow we followed below steps.
Yes, Of course!!! We have a solution for this.
Currently, Flow doesn’t have the ability to let you assign approval to a group directly. However, we have a workaround to send approvals to a SharePoint Group.
That’s enough about the background. Let us see How to Do it.
How to do it.
TO achieve this functionality we need to follow several steps. These detailed steps are given below.
Step 1: Be ready with your SharePoint site and List where you want to apply an approval process.
Step 2: Create a Microsoft Flow from blank. For this go to flow.microsoft.com from your tenant. Then click on Create from Blank.
Step 3: For the trigger, Select ‘SharePoint – When Item is Created‘ and provide your site URL and List/Library URL.
Step 4: Add ‘Send an HTTP request’ action to the flow. Configure all the API’s properly. _api/web/sitegroups/getbyname(‘SharePoint group name’)/users
Step 5: At this point, we need a variable to store user emails, So Add an action- Initialize variable and configure it like below.
Step 6: Now we need to parse a response from the SharePoint Rest API call. Hence we need to add an action from Data Operations- Parse JSON. As a content add Body from Send HTTP request from SharePoint, which is created earlier.
We need to tell flow what schema the response is so that we can use the SharePoint Group response data properly within a flow. Without doing this Flow can’t read values from a bunch of text.
To do this, you can copy below JSON schema and Paste it in Schema section.
To save time , here is full schema you need to add in your flow to get approvers properties like name, email ,etc.
{
"type": "object",
"properties": {
"d": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"__metadata": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"uri": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"Alerts": {
"type": "object",
"properties": {
"__deferred": {
"type": "object",
"properties": {
"uri": {
"type": "string"
}
}
}
}
},
"Groups": {
"type": "object",
"properties": {
"__deferred": {
"type": "object",
"properties": {
"uri": {
"type": "string"
}
}
}
}
},
"Id": {
"type": "integer"
},
"IsHiddenInUI": {
"type": "boolean"
},
"LoginName": {
"type": "string"
},
"Title": {
"type": "string"
},
"PrincipalType": {
"type": "integer"
},
"Email": {
"type": "string"
},
"IsEmailAuthenticationGuestUser": {
"type": "boolean"
},
"IsShareByEmailGuestUser": {
"type": "boolean"
},
"IsSiteAdmin": {
"type": "boolean"
},
"UserId": {
"type": "object",
"properties": {
"__metadata": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
"NameId": {
"type": "string"
},
"NameIdIssuer": {
"type": "string"
}
}
}
},
"required": [
"__metadata",
"Alerts",
"Groups",
"Id",
"IsHiddenInUI",
"LoginName",
"Title",
"PrincipalType",
"Email",
"IsEmailAuthenticationGuestUser",
"IsShareByEmailGuestUser",
"IsSiteAdmin",
"UserId"
]
}
}
}
}
}
}
The complete action looks like below
Step 7: Now we got the data of all users. At this point we are going to retrieve all user’s email addresses into using Apply to each action.
Step 8: Add ‘results’ from Parse JSON action.
Step 9: Add new action within Apply to each called –Append to a string variable. Within this, we need to set our initialized Variable VarApproverEmail and set the value Email.
Very Important, DO NOT FORGET TO ADD SEMICOLON (;) AFTER EMAIL VALUE.
Step 10: Finally, we are all set to get approvers from SharePoint Group. Let us go ahead and use them into Approval Process. So We need to add an action – Start Approval Process. Fill the required Data and in the “Assigned To” field we need to click on see more and find our variable from ‘Dynamic Content’.
Then Choose ‘VarApproverEmail’ variable.
A complete flow Look like this.
Give a name to flow, save it and Run the FLOW! Bingo! All Done.
Like!! Really appreciate you sharing this blog post.Really thank you! Keep writing.
A big thank you for your article.
A big thank you for your article.
Hi there, after reading this amazing paragraph i am as well delighted to share my knowledge here with friends.