in Flow

How to send approval requests to groups in Microsoft Flow

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:

get-azureadgroup -SearchString "somedistributionlist" | select-object objectid

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.

Write a Comment

Comment

11 Comments

  1. 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.

  2. 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

  3. 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

  4. 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.

  5. 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?