Send Email To Multiple Values In People Picker Field In SharePoint

Introduction

Today, I have come across an interesting scenario when sending emails to multiple users in People Picker field. For the approval scenario, I have an ‘Approvers’ list and the value can be more than one in some scenarios. It is required to send approvals to all the users in the People picker field. Below is the screen capture for reference.

The functionality can be achieved by Power Automate. This is a little trickier, let's see this in action.

Steps

Step 1

Login to Power Automate (https://flow.microsoft.com) using your organization credentials.

Step 2

From the home page, click on new flow and select ‘Instant cloud flow’

Step 3

Get items from the SharePoint list. In this scenario, I have configured ‘Approvers’ list to store the approvers by country.

For getting country specific, I have used following OData query

(Title eq 'Legal') and (Country eq 'Brazil')

Step 4

Initialize array variable ‘varApprovers’.

Step 5

Add ‘Compose’ action and select the ‘value’ from ‘Get Items’ action.

Power Automate Send Email to multiple values in People Picker Field in SharePoint

Step 6

Now its time to run the flow manually to get the JSON schema from the ‘compose’ action. This is needed for the ‘Parse JSON’ action.

Power Automate Send Email to multiple values in People Picker Field in SharePoint

Copy the JSON Output. You should be getting the similar data as shown in screen capture.

Step 7

Add the ‘Parse Json’ action from the ‘Compose’ series and in the content field add the ‘Value’ from get items section.

Now click on ‘Generate from sample’ and copy the JSON schema that you have copied at step 7 and click ‘Ok.

Step 8

In this scenario, I need to have these 2 values that are appeared in emails in ‘Approver Array’ to the variable array that is initialized in Step 3.

Add ‘Append to array variable’ action from ‘Variable’ sections. Configure the ‘Name’ as ‘varApprovers’ that is initialized in ‘Step 3’. And the value as ‘Approver’(As this is where the emails are present in Json output’.

Power Automate Send Email to multiple values in People Picker Field in SharePoint

The moment you select it, PowerAutomate automatically configures and adds ‘Foreach’ action. You don’t have to do anything. You should be similar configuration below.

Power Automate Send Email to multiple values in People Picker Field in SharePoint

Step 9

Remove the ‘Append to array variable’ action from the previous step. Now add ‘Another Apply to each action.

Now under ‘Select an output from previous steps’ select ‘Approver’. And inside ‘Apply to each 2’ now add ‘Append to array variable action’ and then select the ‘Email’. Please note that there are 2 Email values from ‘Parse JSON’ outputs. Please select the one that is not associated with author.

Step 10

Use ‘Join’ action and configure ‘Join with’ field to ‘;’

Step 11

Finally send the email. Here I have used ‘Send email notification (V3). You can use any one of your choice.

Validation

Test the flow and it should send email to all the users in the ‘Approver’ field. Please refer to the below screen capture for reference.

If you get stuck, please refer to the attached flow template.

Conclusion

Thus, in this article, we have seen how to send email to multiple users in ‘People picker’ field.

References: 

https://powerusers.microsoft.com/t5/Building-Flows/send-e-mail-to-multiple-users-with-dynamic-content/td-p/73947
https://sharepains.com/2019/09/16/query-json-in-power-automate/
https://vblogs.in/create-an-array-using-append-to-array-variable-in-power-automate/
https://powerusers.microsoft.com/t5/Building-Flows/Array-elements-can-only-be-selected-using-an-integer-index/td-p/900616