cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Cmagee2433
Level: Powered On

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 Team
Community Support Team

Re: List Group Members then Send Email not working

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.
1 REPLY 1
Community Support Team
Community Support Team

Re: List Group Members then Send Email not working

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.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 375 members 5,456 guests
Please welcome our newest community members: