cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

List Group Members then Send Email not working

I'm using the List Group Members function to read the members of an O365 groups.

Later in my flow I try to send an email using those group members and receive this error.

 

The execution of template action 'Apply_to_each_4' failed: the result of the evaluation of 'foreach' expression '@{body('Get_item_3')?['Recipients']}@{body('List_group_members_Field_Coordinators')?['value']}@{body('List_group_members_Inventory_Rep')?['value']}' is of type 'String'. The result must be a valid array.

 

Any idea of why this is happening and how to fix it?ListGroupMembers.PNGGetItem_SendEmail.PNG

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @Cmagee2433 ,

 

Do you want to send an email to users from Office 365 groups and SharePoint list multiple selection enabled people or group column?

 

Please consider using variables in your flow.

 

The following flow could be your reference.

 

Note: “Assigned” is a multiple selection enabled person or group column in SharePoint list.

 

After the trigger When an item is created, initialize two array variables. Test and Test2.

 

Under action Get item, add apply to each for Assigned, select output from dynamic content Assigned, adding action Append to array variable for Assigned. Then select Assigned email for the value field.

 

Add action Get group members.

 

Add action Apply to each for O365 Group, inside the apply to each, add action Append to array variable, select dynamic content Group Members Mail for Value field.

 

Under Apply to each for O365 Group, add a Compose with the following function:

union(variables('Test'),variables('Test2'))

 

Add Apply to each, select value from the Compose output, add action Send an email within it, and select dynamic content Current item in the To field.

 

Images for your reference.

1.PNG2.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support
Community Support

Hi @Cmagee2433 ,

 

Do you want to send an email to users from Office 365 groups and SharePoint list multiple selection enabled people or group column?

 

Please consider using variables in your flow.

 

The following flow could be your reference.

 

Note: “Assigned” is a multiple selection enabled person or group column in SharePoint list.

 

After the trigger When an item is created, initialize two array variables. Test and Test2.

 

Under action Get item, add apply to each for Assigned, select output from dynamic content Assigned, adding action Append to array variable for Assigned. Then select Assigned email for the value field.

 

Add action Get group members.

 

Add action Apply to each for O365 Group, inside the apply to each, add action Append to array variable, select dynamic content Group Members Mail for Value field.

 

Under Apply to each for O365 Group, add a Compose with the following function:

union(variables('Test'),variables('Test2'))

 

Add Apply to each, select value from the Compose output, add action Send an email within it, and select dynamic content Current item in the To field.

 

Images for your reference.

1.PNG2.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (13,200)