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

Update File Properties Person/Group field when there are multiple selection

I have a flow that pulls approvers from a List based upon a department title.  I then create an approval request and send it to multiple people.  

 

I then want to update a file property called "Approval Sent to" (people/group picker that allows multiple selections)

I have tried using the Approvers Email and Display name and both of them fail to update this.  I have only had success with this update only when there is only one approver sent in my variable.

 

See the screen shots below.

 

To get the approvers, I do a select from the Get Items List and join it to a strVariable.

 

When I use that variable to update the file properties when it it only one person, it works.

lopezbec_0-1643401207062.png

 

the create approval will not use an object/array, so I created a string variable that uses the email to send the approval request.

How can I create something to update this file property ?  I will not know if there are 1 or 10 people this approval goes to.

 

Hope someone can help with this.

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Let's start with the Approvers list. Flow is complaining that these users dont existing in your MS 365 tenancy. 

 

In the Update file properties "switch to input entire array" before specifying the value for Approval Sent to:

Snag_1906fce7.png

 Ellis

 

View solution in original post

20 REPLIES 20

 

 

Let me add more details.  If I send the Email for each user to this property, I get this error:

lopezbec_0-1643402419809.png

 

If I use the Approvers Display Name, I get this error:

lopezbec_1-1643402630842.png

Obviously, I know there is an issue with some of this syntax, but if the emails are valid users in the organization, why doesn't that work?

 

 

Try the following format for a multi-select person column.

 

One person:

[
  {
    "Claims": "i:0#.f|membership|DiegoS@onmicrosoft.com"
  }
]

 

Multiple:

[
  {
    "Claims": "i:0#.f|membership|DiegoS@onmicrosoft.com"
  },
  {
    "Claims": "i:0#.f|membership|PradeepG@onmicrosoft.com"
  }
]

 

Snag_5181611.png

 


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

 

 

Thank you for your prompt input, I will try this when I return to the office on Monday. 

I just relooked at this.  This will not work, this updates a list, I am trying to update File Properties.

Any other ideas?

The same method will also work when updating file properties, for example:

Snag_9d4a877.png

 

Snag_9d8bb8e.png

Snag_9d95e75.png


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

I am still having an issue.  Not sure what you are using as the source for the compose statement.

 

I did it after the  create an approval, see output.

lopezbec_0-1643639817280.png

 

I then do an apply to each compose statement using the "Approvers Approver name" ,  It only is providing one name in the output even though there is an apply to each.

lopezbec_1-1643639881906.png

 

I also tried using in the apply to each with the others below:

 

1. "Approvers Item" with "Approvers All of the approvers" Get error:  

 
  "status"400,
  "message""The specified user [{\"id\":\"5b4d5f1c-4c0d-4b28-8c28-f9e242e5d22e\",\"displayName\":\"Laurie xxxxxx\",\"email\":\"xxxxx@xxxxx.com\",\"tenantId\":\"56c62bbe-8598-4b85-9e51-1ca753fa50f2\",\"userPrincipalName\":\"xxxxxx2@xxxxx.com\"},{\"id\":\"701fffd6-231f-4785-a4dd-40e5666062e7\",\"displayName\":\"Becca xxxxxx\",\"email\":\"xxxxxxxx@xxxxx.com\",\"tenantId\":\"56c62bbe-8598-4b85-9e51-1ca753fa50f2\",\"userPrincipalName\":\"Rxxxxxxx8@xxxxxx.com\"}] could not be found.\r\nclientRequestId: 735b87d5-64ab-4c2c-8b6c-ec81ec84bfb5\r\nserviceRequestId: 735b87d5-64ab-4c2c-8b6c-ec81ec84bfb5"
 

 

2. Approvers body with "Approvers All of the Approvers" I get this error: 

 
ExpressionEvaluationFailed. The execution of template action 'Apply_to_each_8' failed: the result of the evaluation of 'foreach' expression '@body('Create_an_approval')' is of type 'Object'. The result must be a valid array.
 
3. Approvers body with Approvers Approver user principal name" and I get this error.
 
ExpressionEvaluationFailed. The execution of template action 'Apply_to_each_8' failed: the result of the evaluation of 'foreach' expression '@body('Create_an_approval')' is of type 'Object'. The result must be a valid array.

 

Can you provide some more details on what I am missing?

 

This is the demo flow that I created. It updates file with SharePoint  ID = 3:

Snag_13805961.png

I have hard-coded the approvers in the Compose Multi action but you should be able to use the approvers' details in the flow.  Please share your flow.


Ellis

I get the approvers name from my list based upon the Department that is tied to my documents.

 

lopezbec_1-1643647905895.png

List:

lopezbec_2-1643647977566.png

 

lopezbec_0-1643647860709.png

I then get the Approver's email that is used for the "create an approval"

lopezbec_3-1643648043201.png

I then create an approval

lopezbec_4-1643648097946.png

After this Approval is created, it is after that step that I want to update the File Properties for my sharepoint document to include all of the approvers the create an approval was sent to.

 

 

 

Can you share your Get File(s) action, and where that fits into the flow:

Snag_13efaf84.png

 

Snag_13effb62.png

Ellis

Ignore the 10 that was placed, I removed that, it is now blank.

For the Get items for the Approvers email - this is used in the Create an Approval step.

lopezbec_3-1643654696111.png

I also get the display name because emails were not working for the file properties to update who the approvers were.

lopezbec_4-1643655269901.png

 

I was not able to use the variable to update the file properties and that is what initiated this original request.

Hopefully this makes sense.

 

After posting this, I do see it is creating two outputs for both approvers when I do the compose, the problem is that the update file properties with the first name and then updating it with the second name, not keeping both. If I try to move the update file properties outside of that apply to each, the output is no longer available.

Here is a demo flow I created, similar to your flow. Library A is a document library and there is an Approvers List based on Department:

Snag_148a7eed.png

This is the get files action to find documents that need to be reviewed: 

Snag_146cb8fa.png

Snag_146d7fc5.png

 

I'm using only one Apply to Each loop- and this works on each document that needs to be approved:

Snag_1478d811.png

Lookup the Department that was specified as a property for the document, then get the members of that department and their email addresses:

Snag_147a647d.png

 

Next Get the email addresses of each member of the department. Note the expression for the From field. There is only every going to be one record for each department in the Approvers list. The Get items - Approvers for Department returns one item and this item will be inside an array. We can just select the first item [0] from that array and we can use an expression to do this:

Snag_147d5905.png

 

outputs('Get_items_-_Approvers_for_Department')?['body/value']?[0]?['Approvers']
item()?['Email']

 

 

Join all the email addresses with a ';' so  that it can be used in an Approval action:

Snag_147f4b21.png

 

Like the email address, we can also get the properties (Claims) we need to set the "Approval Sent to" person column. Note the expression for the From field. Get items - Approvers for Department returns one item which will be inside an array. We can just select the first item [0] from that array and we can use an expression to do this:

Snag_14814d2a.png

 

outputs('Get_items_-_Approvers_for_Department')?['body/value']?[0]?['Approvers']
item()?['Claims']

 

 

Set the variable (the variable is not really needed, but you can refine the flow once it's working):

Snag_14834fd0.png

The Create Approval action:

Snag_14844174.png

 

Now update the "Approval Sent to" person column using the Claim properties we obtained in step (4):

Snag_149c635f.png

This is the sample runtime output:

Snag_149e6cbb.png

Hope this helps.


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

Ellis, I appreciate all of this effort, but I am still having an issue.  I built it exactly has you have here, but I have some system differences that you will see below.  It is failing on the Create an approval, so it hasn't gotten to the Update file properties yet.  See below:

 

I have the trigger as When a file is create or modified because the Get items cannot be used as a trigger.

lopezbec_1-1643720825527.png

lopezbec_2-1643720843011.png

I get the file properties:

lopezbec_3-1643720970654.pnglopezbec_4-1643720989737.pnglopezbec_5-1643721017017.png

lopezbec_6-1643721047059.pnglopezbec_7-1643721075158.png

In the Select, I do not have the output to select, I had to manually enter this as a function.  Same with Email map.

lopezbec_8-1643721121665.png

 

lopezbec_9-1643721136506.pnglopezbec_10-1643721163356.png

The Select Claims again I had to manually enter the output and the item for claims. , it was not available to add

lopezbec_11-1643721200925.png

lopezbec_12-1643721224703.png

lopezbec_13-1643721260380.pnglopezbec_14-1643721279379.png

When running error received:  

I copied the output from each as I tested it.

lopezbec_15-1643721401892.png

lopezbec_16-1643721451709.png

 

Inputs from Select Email:

lopezbec_17-1643721764627.png

Outputs:

lopezbec_18-1643721818501.png

 

Join output has the : in the join.

lopezbec_19-1643721871462.png

Output from Select Claims

lopezbec_20-1643721923468.png

strApprovers Variable

lopezbec_21-1643721980018.png

 

 

 

 

For the Select action you will need to switch to text mode:

Snag_182233df.png

2022-02-01_13-53-05.gif

Ellis

Ok, that works, now when it is trying to update the file properties, this is happening:

 

first I get an warning before I test:

'Actions in this flow may result in an infinite trigger loop. Please ensure you add appropriate conditional checks to prevent this flow from triggering itself."

 

Error:

lopezbec_0-1643725582588.png

Select Claims, I had to manually add the output as a function

lopezbec_1-1643725670193.png

Same for the mapping of Claims item

lopezbec_2-1643725707820.pnglopezbec_3-1643725732250.png

 

 

 

lopezbec_4-1643725758547.png

lopezbec_5-1643725782770.png

 

 

 

 

You're going to need to set some trigger conditions so that the flow does not trigger itself each time you update the file properties.  For example, if the ReviewRequired column is true and the ApprovalSentTo column is empty:

 

Snag_18812ac9.png

  

Snag_18841619.png

Here is an updated flow, based on the new trigger and trigger conditions:

ekarim2020_2-1643730953956.png

ekarim2020_3-1643730992186.png

 

ekarim2020_4-1643731023638.png

ekarim2020_0-1643739460027.png

 

 

Ellis

The Create Approval works and sends it out, but the Select claims and Update file properties are still an issue, see screen shots below:

 

Trigger, I added conditions, but I still get this message in Flow Checker:

lopezbec_0-1643736462786.png

Actions in this flow may result in an infinite trigger loop. Please ensure you add appropriate conditional checks to prevent this flow from triggering itself.

 

Claims Select, again, I had to enter the functions manually, the output was not available.  It doesn't like something here.

lopezbec_1-1643736552013.png

lopezbec_2-1643736577075.pnglopezbec_3-1643736598570.png

 

lopezbec_4-1643736631750.pnglopezbec_5-1643736652454.png

Error received from Update File Properties:

lopezbec_7-1643736779856.png

 

Output

lopezbec_6-1643736711651.png

 

 

 

Let's start with the Approvers list. Flow is complaining that these users dont existing in your MS 365 tenancy. 

 

In the Update file properties "switch to input entire array" before specifying the value for Approval Sent to:

Snag_1906fce7.png

 Ellis

 

That did it.  THANK YOU!!!! So much.  For those that see this later, there is multiple strings of responses you need to look at to make this work.  Ellis - you are a great resource and I appreciate all you have done to help me out!!!  Kudos.

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 (1,635)