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.
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.
Solved! Go to Solution.
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:
Ellis
Let me add more details. If I send the Email for each user to this property, I get this error:
If I use the Approvers Display Name, I get this error:
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"
}
]
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:
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.
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.
I also tried using in the apply to each with the others below:
1. "Approvers Item" with "Approvers All of the approvers" Get error:
2. Approvers body with "Approvers All of the Approvers" I get this error:
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:
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.
List:
I then get the Approver's email that is used for the "create an approval"
I then create an approval
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:
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.
I also get the display name because emails were not working for the file properties to update who the approvers were.
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:
This is the get files action to find documents that need to be reviewed:
I'm using only one Apply to Each loop- and this works on each document that needs to be approved:
Lookup the Department that was specified as a property for the document, then get the members of that department and their email addresses:
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:
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:
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:
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):
The Create Approval action:
Now update the "Approval Sent to" person column using the Claim properties we obtained in step (4):
This is the sample runtime output:
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.
I get the file properties:
In the Select, I do not have the output to select, I had to manually enter this as a function. Same with Email map.
The Select Claims again I had to manually enter the output and the item for claims. , it was not available to add
When running error received:
I copied the output from each as I tested it.
Inputs from Select Email:
Outputs:
Join output has the : in the join.
Output from Select Claims
strApprovers Variable
For the Select action you will need to switch to text mode:
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:
Select Claims, I had to manually add the output as a function
Same for the mapping of Claims item
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:
Here is an updated flow, based on the new trigger and trigger conditions:
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:
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.
Error received from Update File Properties:
Output
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:
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.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
68 | |
23 | |
17 | |
16 | |
13 |
User | Count |
---|---|
121 | |
35 | |
33 | |
28 | |
26 |