Skip to main content

Notifications

Power Automate - General Discussion
Unanswered

Set unique value, outside the nested Apply to each Loop to create an Item targeting People picker column "Allow Multiple Selection". #RetrivedUserDetailsfromJobTitle

(0) ShareShare
ReportReport
Posted on by

Hello, I am bit stuck here. I am hoping if any one here can assist me on this issue.

 

User case:

I have a SharePoint list "JobTitleList" that has a Single line text column called "RecipientPosition". The item stored in that column is users job title separated with semicolon " ; ".  See the snap shot below.

Arikshrestha_1-1697910490294.png

I have another list "MainList" that stores the users email from there job title in a people picker column by using power automate. "Allow multiple selection" is enable in the people picker column. See snapshot below.

Arikshrestha_2-1697914025915.png

 

 I was able to get the users detail by there Job title using Microsoft Graph API. But I was not able to associate each user jobtitle to the the recipient people picker column in another list.  Here is what I did to get those values. See the screen shot below as well.

  1. I Used Get Items trigger to get the "RecipientPosition" from the List
  2. Separated the users job title using split function to get each job title from the list which created an Apply to each Loop.
  3. Created a compose trigger to store each job title value in another Apply to each loop, which is nested under the first apply to each loop.
  4. In the nested apply to each loop:
    1. I invoked an HTTP Request to get the users detail by there job title
    2. Mapped to get "userPrincipalName" from the body of the HTTP Request.
    3. Used the first funtion to get the object from an array
    4. Append to each array on the nested apply to each loop.
    5. And Here is where I am Stuck??
      1. For Each loop on Nested Apply to each loop, I want to get only one value and append that value to the parent apply to each loop. so that I can add those users email in the people picker column
      2. Currently, the Append to each loop on the First loop "Apply to each 9", I am getting the repetative value of Nested loop.

I hope this diagram might help to understand. I think my explanation might be complicated to understand.

Arikshrestha_6-1697916902870.png

 

 

1 is First Loop Apply to each 9

2 is nested loop under Apply to each 9

Arikshrestha_3-1697915353582.png

 

The below snap shot is inside the "Parent Loop Apply to each 9" On this section, Since I am using Append to array trigger, its appending the duplication values from nested loop. Example,

First Parent Apply to each 9 loop give me two values,

[

{"Claims": "UserEmail1"},

{"Claims": "UserEmail2"}

]

The second loop with in Apply to each 9 loop gives me 4 values including the values of 1st loop.

 

[

{"Claims": "UserEmail1"},

{"Claims": "UserEmail2"},

{"Claims": "UserEmail3"},

{"Claims": "UserEmail4"}

]

 

How would I remove the duplication values from the loop so that I can get unique value for each loop?

Arikshrestha_5-1697916090488.png

 

 

I took me while to formulate this question. Don't know if I made my statement clear. But I am looking to see if any one can help me out here.

 

Thanks

 

 

 

 

 

 

 

  • Nived_Nambiar Profile Picture
    Nived_Nambiar 17,024 on at
    Re: Set unique value, outside the nested Apply to each Loop to create an Item targeting People picker column "Allow Multiple Selection". #RetrivedUserDetailsfromJobTitle

    Hi @Arikshrestha 

     

    I think i got the cause of the issue. 

     

    The array to which you are appending the user email values should be set as empty before starting of next iteration from parent level. You can place set variable action with setting the array variable as empty before the split operation. So that it won't take the previous iteration values.

     

    Hope it helps !

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,343

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard