cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Replace a name or names in multi-select person column based on a Filter Query

Hi! I need help trying to replace a name or names in a multi-person column that satisfies a filter query.

 

I have 2 SP Lists, ListData2 and ListData2Delegation.

ListData2 have a multi-person column for Signers (similar to approvers).

ListData2Delegation is where approvers log their time away for a period of dates (From and To).

 

My flow checks to see if any of the approvers of an item in main list are away and then I want to replace their names with the assigned backups from delegation List. Is this possible? My filter query works but I don't know how to update the names in multi-person column in ListData2.

 

Here is my flow:

 

jaanihsm_0-1717381814118.png

 

Any help is appreciated! Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi , @jaanihsm 

I create a test flow and this is my test Sahrepoint and the end result in my side:

vyueyunmsft_0-1717574116437.png

This is my flow , you can refer to :

vyueyunmsft_1-1717574149304.png

(1)The Select and Get items action:

vyueyunmsft_3-1717574267969.png

concat( ' Author/EMail eq ''' , item()?['Email'] , '''' )
join(body('Select'),' or')
utcNow()
 
(2)The Select 2 and initialize variable action:
vyueyunmsft_4-1717574349825.png
item()?['Author']?['Email']
 
(3)The Apply to each action:
vyueyunmsft_5-1717574502171.png
contains(body('Select_2') , items('Apply_to_each')?['Email'] )
true
 
xpath( xml(json(concat('{"root":{"item":',outputs('Get_items')?['body/value'],'}}'))) , concat('/root/item[./Author/Email="' , items('Apply_to_each')?['Email']  , '"]/DelegatingTo/Claims/text()' ))?[0]
 
items('Apply_to_each')?['Claims']
 
(4) The Update item action:
vyueyunmsft_6-1717574570850.png

 

 

If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

 

Best Regards,

Yueyun Zhang

 

 

 
 

 

 

 

View solution in original post

11 REPLIES 11
v-yueyun-msft
Community Support
Community Support

Hi , @jaanihsm 

According to your description, do you mean you want to directly replace the multiple-person  column in SharePoint?

And you use the Filter query to get the items from your list and you just need to update the item when the length =1.

So you can refer to this flow:

vyueyunmsft_0-1717384206384.png

 

outputs('Get_items')?['body/value']?[0]?['Signers']
item()?['Claims']

 

Best Regards,

Yueyun Zhang

Hi @v-yueyun-msft. Thank you for your response! Appreciate your help and time! 🙂

 

Do I add Select after Get Items? I tried this but I get this error...

 

jaanihsm_0-1717446450799.png

 

Also, will this work in this scenario? 

I have 2 Signers, first one is available, second one needs to delegate? 

How do I get the Signers array where it keeps the first name then replaces the second name with the assigned backup?

 

Thank youu! 🙂

Hi, @jaanihsm 

This error code means that your expression is wrong in your side.

vyueyunmsft_0-1717466350913.png

outputs('Get_items')?['body/value']?[0]?['Signers']
 
In my test flow ,  What it achieves is to replace all the people in the column.
For example, the column in List A contains Person A and Person B; Then I'll replace the column in List B with Person A, Person B.
 
And , i am not surely understand the meaning of "get the Signers array where it keeps the first name then replaces the second name with the assigned backup". Can you give me a screenshot for your two SharePoint list and give me a detailed example for it so that i can help you better!
 

 

Best Regards,

Yueyun Zhang

Thank you so much for the follow-up response @v-yueyun-msft! I really appreciate your time and efforts!

 

Here is my main list (ListData2) where users create an item for signature/approval.

Signers is a dynamic multi-select person column.

Assigned To is a single-select person column and automatically gets the first signer then moves to the next one in the sequence.

Signatures Collected (default value = 0) column counts the number of actions taken by the approvers. Flow continues to forward the approval until Signatures Collected = number of signers, unless anyone rejects.

 

jaanihsm_4-1717536058554.png

 

Here is my second list (ListData2Delegation) where signers/approvers log their time away.

Delegating To is a single-select person column. 'Created by' will be one of the approvers that assigns a backup for a period of time (From, To).

 

jaanihsm_3-1717536020801.png

 

My Approval flow type is Approve/Reject - First to respond because I need the signers to sign in order.

I need help to update the 'Signers' column through a Filter query from the ListData2Delegation

where > (Author/Email eq 'Current Signer or Current Assigned To') and (From le 'utcNow()' ) and (To ge 'utcNow()').

Replace the current 'Signer' (when it's his/her turn) with assigned back up from ListData2Delegation and apply the same to other Signers if applicable.

 

Here is my approval flow without the delegation part. Not sure how to properly execute it. The screenshot from my first post is a test flow I'm trying.

 

jaanihsm_2-1717535792958.png

 

Thanks in advance for sharing your knowledge! Greatly appreciate it!

 

Is it best to first, take all Signers names and check if any of them have delegates based on the filter query, then replace the names of Signers satisfying the query while maintaining the Signers sequence and then start the flow approval? I'm not sure which way is better or easier. And I'm lost as to how to execute the delegation requirement. Thanks again @v-yueyun-msft !

Hi , @jaanihsm 

I create a test flow and this is my test Sahrepoint and the end result in my side:

vyueyunmsft_0-1717574116437.png

This is my flow , you can refer to :

vyueyunmsft_1-1717574149304.png

(1)The Select and Get items action:

vyueyunmsft_3-1717574267969.png

concat( ' Author/EMail eq ''' , item()?['Email'] , '''' )
join(body('Select'),' or')
utcNow()
 
(2)The Select 2 and initialize variable action:
vyueyunmsft_4-1717574349825.png
item()?['Author']?['Email']
 
(3)The Apply to each action:
vyueyunmsft_5-1717574502171.png
contains(body('Select_2') , items('Apply_to_each')?['Email'] )
true
 
xpath( xml(json(concat('{"root":{"item":',outputs('Get_items')?['body/value'],'}}'))) , concat('/root/item[./Author/Email="' , items('Apply_to_each')?['Email']  , '"]/DelegatingTo/Claims/text()' ))?[0]
 
items('Apply_to_each')?['Claims']
 
(4) The Update item action:
vyueyunmsft_6-1717574570850.png

 

 

If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

 

Best Regards,

Yueyun Zhang

 

 

 
 

 

 

 

Hi @v-yueyun-msft! I believe this is what I need! I will test and let you know! Thank you so much for your support! Greatly appreciate it. 🙂

Hi @v-yueyun-msft! I was able to test it today. Looks great! Working as expected! Genius!

 

However I have a follow-up question. I also have an 'Assigned To' single-select person column which automatically gets the Signer name who is their turn to sign (based from the Signer order).

 

How do I update it too? In this case, first Signer was delegated. Please see screenshot.

I tried something but my outputs are inconsistent. 😞 Thank you so muuuch! 🙌

 

jaanihsm_0-1717712312053.png

 

 

 

Hi @v-yueyun-msft! I hope you can help me with this last part on my flow. 🙂 Thank you in advance for your support!

Hi , @jaanihsm 

Thanks for your response! If you want to make the first person in [Assigned To] column.

You can use this expression in the last action:

vyueyunmsft_0-1718072747477.png

 

first(variables('Approvers'))?['Claims']
 

If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

 

Best Regards,

Yueyun Zhang

That did it @v-yueyun-msft! Thank you so much! You're so helpful! Appreciate your time and knowledge-sharing! 🙂

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (774)