Context
The Microsoft Flow Approvals connector does not support sending approval requests to groups today.
If you want to send an approval request to an email address belonging to a group, as illustrated in the screenshot below:
The following issue may occur:
BadRequest. The request failed. Error code: 'InvalidApprovalCreateRequestAssignedToNoValidUsers'. Error Message: 'Required field 'assignedTo' contained no valid users in the organization'.
This error is expected because the email address used in the Assigned to field is not matching any valid user.
Workaround
The workaround is to first get the members from the group, and append their email addresses to a string variable, and then use the variable in the recipient field on the Approvals action.
This workaround will send the approval request to the mailbox of each group member. It will not send the approval request to the group mailbox.
To test this workaround, create a flow that starts When an item is created in a SharePoint list.
Then continue with a Initialize variable action and initialize a string variable varEmails
Search for the Office 365 Groups connector and add the List group members action.
Pick the group from the Group Id drop-down or, if you can't find it in the list, enter the group GUID in the field.
This action works with Office 365 Groups, Security Groups, and Distribution Lists.
To get the group GUID, either use PowerShell:
ObjectId
——–
acb1e500-be76-4506-a816-442ccc917f14
Or go to Azure AD groups and search for the group and get the GUID that way:
Don't forget to change the pagination settings of the List group members action if you have more than 999 members in your group.
Turning on pagination will ensure that all members will be pulled by the action.
Next add an Apply to each control and point it to members array coming from List group members action output.
Inside the Apply to each control add an Append to string variable action and append the Mail item to the varEmails variable
Don't forget to add the semicolon ; after the Mail item to make sure the email addresses are correctly separated in the string enumeration.
Lastly, add the Start and wait for an approval action and put the varEmails variable in the the Assigned to field.
The flow run should look like this:
The entire flow should look like this:
You can download this flow from here.
Thanks so much for this guide, it has been very helpful!
Happy to hear it worked for you, Alberto! 🙂
Hi Alex, this worked for me like a charm. I'm using a solution & if in Dev, I have a test office group & when I export the solution to Prod, how do I switch using environment variables? I attempted a text type environment variable and that threw an error. Thank you.
Hi,
But, what if I want to send the for some of the emails in the group? The approvers are some of the group!
Thanks,
Hi Waleed, in that case you may want to create a separate group only with the approvers, or if you cannot do that, create the necessary logic in your flow to only include the approvers, but in that case it would defeat the purpose of using a group in the first place.
Hey Alex.
Good guide. Let me ask: Using this flow i can use to create as a classic workflow? E.G: click on item (doc) changed, choose flow and type manually approval user email? Just like old workflow classic?
Thank you
Yes you can. You have to change the trigger to "for a selected item".
Hi Alex,
In the SP list that includes all emails I am the Owner and the approvers are members, I want to remove myself because I am not part in the flow, but SP ask me to assign another owner! If I assign one of the members as an owner, then will he be in the flow and can approve? because I want him (the owner) be an approver!
Thanks,
Waleed
Hi Alex, is there any way to use send approval or send emails with options for all list items(more than 50 items) at the same time for attestation purposes. And based on repose update each item.
Yes, you have to use Get Items, then Apply to each and inside Apply to each send an approval request for each item.
Hi Alex, thank you for your tips. It's very helpful. By the way, at the moment there are no ways to send the approval request to the group mailbox?
Correct, this is not supported.
Hi, your post is very informative. I want to send approval to Group A. When one of Group A members approves it, I need to assign to Group B, C or D depends on the item details.
Based on the list item, the approval needs to be sent to particular group.
Is it possible?
Yes, but in this case you would need to get the members for each group and put each group in an array variable and work that way.
Hi Swathi,
did you figure out how to add approval to gruop A, and group B in the assigned to box? instead of adding oneby one?
thanks a lot
Thank you Alex for amazing article. Worked perfectly fine….. I was struggling with this……
Glad to hear it was useful! 🙂
When I add the approval object it wraps it in a Apply to Each automatically. The example does not do this. Anyone else see this behavior?
Found the answer. I was using the get items instead of get item. This is a manual approval. Hopefully it helps someone else. Thank you.
I have 300 workers in a group. It sends approval only for a 50 workers. Is there a workaround. How to solve this or are there any ways to make timeout and then it sends for another 50?
Hi Alex and everyone,
I am creating a flow wherein a user inputs their manager's email address in MS Forms and then via PowerAutomate the manager's email address is picked up from that field and then triggers an approval flow and the request is sent to the manager email address input in MS Forms. I followed the below, defined the varEmails, Type = String and Value = Manager email address (i.e., the field from MS Forms). However, I get the same message, Required field 'assignedTo' contained no valid users in the organization'. Please help, thank you.
Create a compose axtion before the approval action and output the email address from the form. Is iy a valid email address? If you are building in default environment then all users should be present in the org else if you are building in a dev environment locked to a security group then only the security members can be used in the approval.
Thank you! Really sucks to see that this has been a feature request since 2017 and they still haven't implemented it yet. Also really sucks that you gotta look up an object id X_X come on microsoft get your stuff together.
Hi Alex and everyone
I am having the same scenario as shown above. But "everyone must approve" in the approval options. Can you please suggest me the way how to track where the application is pending with?
Has this now dropped to max 3 approvers? My input string has 6 emails in but the JSON for the approval shows only 3 approvers are processed, took me a while to notice that one…
Hi Alex,
When I have more than one person in the specific security group, I get an error-
'InvalidApprovalCreateRequestAssignedToNoValidUsers'. Error Message: 'Required field 'assignedTo' contained no valid users in the organization'. Its working fine with one user. Something I`m missing here?
Thanks.
Awesome explanation. Thank you! I cannot thank you enough.