cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lopezbec
Helper II
Helper II

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
lopezbec
Helper II
Helper II

 

 

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?

 

 

ekarim2020
Super User
Super User

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.

lopezbec
Helper II
Helper II

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

lopezbec
Helper II
Helper II

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

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!

April 2024 Community Newsletter

We're pleased to share the April Community Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members.   If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across Microsoft Power Platform and beyond.    COMMUNITY HIGHLIGHTS   Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, follow these awesome community members to see what they do!   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzDeenujialexander2523ragavanrajanLaurensMManishSolankiMattJimisonLucas001AmikcapuanodanilostephenrobertOliverRodriguestimlAndrewJManikandanSFubarmmbr1606VishnuReddy1997theMacResolutionsVishalJhaveriVictorIvanidzejsrandhawahagrua33ikExpiscornovusFGuerrero1PowerAddictgulshankhuranaANBExpiscornovusprathyooSpongYeNived_Nambiardeeksha15795apangelesGochixgrantjenkinsvasu24Mfon   LATEST NEWS   Business Applications Launch Event - On Demand In case you missed the Business Applications Launch Event, you can now catch up on all the announcements and watch the entire event on-demand inside Charles Lamanna's latest cloud blog.   This is your one stop shop for all the latest Copilot features across Power Platform and #Dynamics365, including first-hand looks at how companies such as Lenovo, Sonepar, Ford Motor Company, Omnicom and more are using these new capabilities in transformative ways. Click the image below to watch today!   Power Platform Community Conference 2024 is here! It's time to look forward to the next installment of the Power Platform Community Conference, which takes place this year on 18-20th September 2024 at the MGM Grand in Las Vegas!   Come and be inspired by Microsoft senior thought leaders and the engineers behind the #PowerPlatform, with Charles Lamanna, Sangya Singh, Ryan Cunningham, Kim Manis, Nirav Shah, Omar Aftab and Leon Welicki already confirmed to speak. You'll also be able to learn from industry experts and Microsoft MVPs who are dedicated to bridging the gap between humanity and technology. These include the likes of Lisa Crosbie, Victor Dantas, Kristine Kolodziejski, David Yack, Daniel Christian, Miguel Félix, and Mats Necker, with many more to be announced over the coming weeks.   Click here to watch our brand-new sizzle reel for #PPCC24 or click the image below to find out more about registration. See you in Vegas!       Power Up Program Announces New Video-Based Learning Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram. These include a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the image below to find out more!   UPCOMING EVENTS Microsoft Build - Seattle and Online - 21-23rd May 2024 Taking place on 21-23rd May 2024 both online and in Seattle, this is the perfect event to learn more about low code development, creating copilots, cloud platforms, and so much more to help you unleash the power of AI.   There's a serious wealth of talent speaking across the three days, including the likes of Satya Nadella, Amanda K. Silver, Scott Guthrie, Sarah Bird, Charles Lamanna, Miti J., Kevin Scott, Asha Sharma, Rajesh Jha, Arun Ulag, Clay Wesener, and many more.   And don't worry if you can't make it to Seattle, the event will be online and totally free to join. Click the image below to register for #MSBuild today!   European Collab Summit - Germany - 14-16th May 2024 The clock is counting down to the amazing European Collaboration Summit, which takes place in Germany May 14-16, 2024. #CollabSummit2024 is designed to provide cutting-edge insights and best practices into Power Platform, Microsoft 365, Teams, Viva, and so much more. There's a whole host of experts speakers across the three-day event, including the likes of Vesa Juvonen, Laurie Pottmeyer, Dan Holme, Mark Kashman, Dona Sarkar, Gavin Barron, Emily Mancini, Martina Grom, Ahmad Najjar, Liz Sundet, Nikki Chapple, Sara Fennah, Seb Matthews, Tobias Martin, Zoe Wilson, Fabian Williams, and many more.   Click the image below to find out more about #ECS2024 and register today!     Microsoft 365 & Power Platform Conference - Seattle - 3-7th June If you're looking to turbo boost your Power Platform skills this year, why not take a look at everything TechCon365 has to offer at the Seattle Convention Center on June 3-7, 2024.   This amazing 3-day conference (with 2 optional days of workshops) offers over 130 sessions across multiple tracks, alongside 25 workshops presented by Power Platform, Microsoft 365, Microsoft Teams, Viva, Azure, Copilot and AI experts. There's a great array of speakers, including the likes of Nirav Shah, Naomi Moneypenny, Jason Himmelstein, Heather Cook, Karuana Gatimu, Mark Kashman, Michelle Gilbert, Taiki Y., Kristi K., Nate Chamberlain, Julie Koesmarno, Daniel Glenn, Sarah Haase, Marc Windle, Amit Vasu, Joanne C Klein, Agnes Molnar, and many more.   Click the image below for more #Techcon365 intel and register today!     For more events, click the image below to visit the Microsoft Community Days website.      

Tuesday Tip | Update Your Community Profile Today!

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   We're excited to announce that updating your community profile has never been easier! Keeping your profile up to date is essential for staying connected and engaged with the community.   Check out the following Support Articles with these topics: Accessing Your Community ProfileRetrieving Your Profile URLUpdating Your Community Profile Time ZoneChanging Your Community Profile Picture (Avatar)Setting Your Date Display Preferences Click on your community link for more information: Power Apps, Power Automate, Power Pages, Copilot Studio   Thank you for being an active part of our community. Your contributions make a difference! Best Regards, The Community Management Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Super User of the Month | Ahmed Salih

We're thrilled to announce that Ahmed Salih is our Super User of the Month for April 2024. Ahmed has been one of our most active Super Users this year--in fact, he kicked off the year in our Community with this great video reminder of why being a Super User has been so important to him!   Ahmed is the Senior Power Platform Architect at Saint Jude's Children's Research Hospital in Memphis. He's been a Super User for two seasons and is also a Microsoft MVP! He's celebrating his 3rd year being active in the Community--and he's received more than 500 kudos while authoring nearly 300 solutions. Ahmed's contributions to the Super User in Training program has been invaluable, with his most recent session with SUIT highlighting an incredible amount of best practices and tips that have helped him achieve his success.   Ahmed's infectious enthusiasm and boundless energy are a key reason why so many Community members appreciate how he brings his personality--and expertise--to every interaction. With all the solutions he provides, his willingness to help the Community learn more about Power Platform, and his sheer joy in life, we are pleased to celebrate Ahmed and all his contributions! You can find him in the Community and on LinkedIn. Congratulations, Ahmed--thank you for being a SUPER user!

Tuesday Tip: Getting Started with Private Messages & Macros

Welcome to TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   This Week's Tip: Private Messaging & Macros in Power Apps Community   Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member!   Our Knowledge Base article about private messaging and macros is the best place to find out more. Check it out today and discover some key tips and tricks when it comes to messages and macros:   Private Messaging: Learn how to enable private messages in your community profile and ensure you’re connected with other community membersMacros Explained: Discover the convenience of macros—prewritten text snippets that save time when posting in forums or sending private messagesCreating Macros: Follow simple steps to create your own macros for efficient communication within the Power Apps CommunityUsage Guide: Understand how to apply macros in posts and private messages, enhancing your interaction with the Community For detailed instructions and more information, visit the full page in your community today:Power Apps: Enabling Private Messaging & How to Use Macros (Power Apps)Power Automate: Enabling Private Messaging & How to Use Macros (Power Automate)  Copilot Studio: Enabling Private Messaging &How to Use Macros (Copilot Studio) Power Pages: Enabling Private Messaging & How to Use Macros (Power Pages)

Users online (6,039)