cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

comparing multiple value people picket field from SharePoint

Hello Community,

 

I have SharePoint list with 2 people Picker column

1. Assigned To

2. Previous Assigned To 

both with multi value yes.

 

I want to compare both values and if there is different then send email else don't send email.

 

Like:

 

Assigned To - A,B and Previous Assigned to - A, C or C, D or B, C or B, D  then send email

even single value changes from both the fields send email

after sending email, I will Update Previous Assigned To = Assigned To, so i can use that data for next modification.

 

For single value field i was able to achieve but not for multi value.

Please help

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: comparing multiple value people picket field from SharePoint

@fd00094 

There may be more elegant solutions, but please see my screen shot below.  I have two person or group columns - PG1 and PG2 and both allow for multi-select.  I build an array of email addresses from PG2 and then loop to see if the PG1 email address appears in the array.  If not, then send an email.  Please note that I selected PG1 Item for the second loop.

PG1.jpgPG2.jpgPG3.jpg

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

9 REPLIES 9
Highlighted
Dual Super User III
Dual Super User III

Re: comparing multiple value people picket field from SharePoint

Hi!

I believe both fields of type multiperson are modeled as an array of objects each person an object.

100% sure that intersection() WDL function can help you to identify persons in both field values.

 

equals() WDL function can probably help you also to compare if both arrays have the same elements or not

Not with my laptop, unable to test



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Dual Super User III
Dual Super User III

Re: comparing multiple value people picket field from SharePoint

Hi!

I believe both fields of type multiperson are modeled as an array of objects, each person an object.

100% sure that intersection() WDL function can help you to identify persons in both field values.

 

equals() WDL function can probably help you also to compare if both arrays have the same elements or not

Not with my laptop, unable to test



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Helper III
Helper III

Re: comparing multiple value people picket field from SharePoint

Hello @efialttes 

 

I have tried this but no luck...
and also flow is going in loop because of update action....

 

Please help on both concerns

Highlighted
Dual Super User III
Dual Super User III

Re: comparing multiple value people picket field from SharePoint

Hi!

I have successfully set up the following test scenario.

One Sharepoint list with two columns called 'Multiperson' and 'LastMultiperson'.

Two items defined, first item has the two same two persons assigned to both column but in reverse order (A,B) and (B,A). second item has two persons in both columns (A,B) and (A,C)

 

My flow design has a manual trigger, then a 'Get items', then an 'Apply to each'. 'Get items' output is assigned to 'Apply to each' input. Pleasee see details of 'Apply to each' in the screenshot:

When I execute it:

first iteration of the 'Apply to Each' evaluates item (A,B) (B,A) and takes 'Condition true branch':

second iteration of the 'Apply to each' evaluates item (A,B) (A,C) and takes 'Condition false branch'.

FLow_CompareMultiPerson_1.png

Please note if I declare the Condition rule with 'Multiperson' on one side and 'LastMultiperson' on the other, both of the iterations will taje 'Condition false branch'. So the role of intersection() expression is to ensure both sides of the condition rule have their common elements in the same order

 

Hope this helps

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Super User III
Super User III

Re: comparing multiple value people picket field from SharePoint

@fd00094 

So, if there is a person in the assigned to column that does not appear in the previous assigned to column, then send them an email - correct?

If there are two people in the assigned to column and only one of them does not appear in the previous assigned to column, should the email go to the new person or both?

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Highlighted
Helper III
Helper III

Re: comparing multiple value people picket field from SharePoint

Hello @ScottShearer 

 

So, if there is a person in the assigned to column that does not appear in the previous assigned to column, then send them an email - correct? - Yes 

 

If there are two people in the assigned to column and only one of them does not appear in the previous assigned to column, should the email go to the new person or both? - If possible then we will send email to new person only or both is fine, because no of person may increase more than 3-4 

 

 

 

Highlighted
Super User III
Super User III

Re: comparing multiple value people picket field from SharePoint

@fd00094 

There may be more elegant solutions, but please see my screen shot below.  I have two person or group columns - PG1 and PG2 and both allow for multi-select.  I build an array of email addresses from PG2 and then loop to see if the PG1 email address appears in the array.  If not, then send an email.  Please note that I selected PG1 Item for the second loop.

PG1.jpgPG2.jpgPG3.jpg

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

Highlighted
Helper III
Helper III

Re: comparing multiple value people picket field from SharePoint

Thank You @ScottShearer  It works

Highlighted
Super User III
Super User III

Re: comparing multiple value people picket field from SharePoint

@fd00094 

I'm glad I could help!

Please mark your post as solved so that it will easier for others to find the solution if they have a similar issue.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Users online (7,827)