Send Email to Multiple Users in People Picker Field SharePoint

Introduction

Today, I have come across an interesting scenario when sending emails to multiple users in the 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.

Approvers

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’

Instant cloud flow

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

SharePoint list

For getting country-specific, I have used the following OData query.

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

Step 4. Initialize array variable ‘varApprovers’.

VarApprovers

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

Compose

Step 6. Now it's time to run the flow manually to get the JSON schema from the ‘compose’ action. This is needed for the ‘Parse JSON’ action.

Copy the JSON Output. You should be getting 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 the getting items section.

Parse JSON

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 appear in emails in the ‘Approver Array’ to the variable array that is initialized in Step 3.

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

Variable sections

Append

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

PowerAutomate

Apply to each

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

Append to array variable

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 the ‘Parse JSON’ outputs. Please select the one that is not associated with the author.

Parse JSON

Step 10. Use the ‘Join’ action and configure the ‘Join with’ field to ‘;’

Join

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

Send email notification

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.

Approver’ field

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

Conclusion

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

References


Similar Articles