I have a problem with the action "Update item", when updating an item in a Sharepoint list. The sharepoint list is used to record document approval flows (Start and wait for an approval).
To create the item in the sharepoint list I use the create elements action, but in the fields of the list I use information from the action Start and wait for an approval, and that causes me to change to “Apply to each one”. (IMAGE “Error 1”)
When I call "Update item" in the second approver of the document, it throws an error because I cannot extract the ID of the item that I created in the sharepoint list with "Create item" to include it in the identifier field, because I think it is not a valid dynamic content.
This is the error message: Template validation failed: "The entries for the template action "Update_element" in line "1" and columna "25053" are invalid. Action "Apply_to_each_one_41" must be a scope "for each" primary of the "Update_element" action so that the "repeatItems" or "items" functions refer to it.". (Image 2)
Please can you help me to know how can I solve this error or how can I update the item in the sharepoint list without the action becoming “Apply for each one”. (IMAGE “Error 2”).
Could you explain your complete requirement from the flow which you have designed? Also, it'll be of great help if you could send the screenshots in English.
Hello @nitika ,
I am developing a workflow for a document (Procedure, Manual, etc.) to be approved by several people. The flow was triggered manually when I select the document in a Sharepoint library. Image 1 Trigger Flow.
For approvals I use the "Star and wait for an approval" action, which triggers a mail flow where the person can approve or reject. Image 2 Star and wait for an approval.
The traceability of the approval flow I am taking through a Sharepoint list (I tried to create and configure the fields in the library and I could not, almost damaged the entire sharepoint site), and for this I use the “create item” action (Image 3 Create Item), with the Next information:
Name - File Name
User name - The display name of the user who triggered the flow
Responses Approver name - The name of the approver
Responses comments - Comments added by the approver
Outcome - The outcome of the approval
Completation Date - Date the approval was complete
When the item is created, an ID is automatically generated for the item in the sharepoint list, and that ID is what I want to use to update the item.
The flow continues into the next stage, which is reviewing the document by a second approver, and this is where I have the problem. When I use the action "Update item" (Image 4 Update item) in the second approver of the document, it throws the following error:
The inputs of template action "Update item" at line '1 and column 26811' is invalid. Action 'Apply_to_each' must be a parent 'foreach' scope of action 'Update item' to be referenced by 'repeatItems'or 'items' functions. Image 5 Update item error.
It is at this stage where the error is being presented, because I cannot get the ID of the item from the sharepoint list to update it. I think it may be because the action "Create item" is framed in another one that is "Apply to each", but I have not been able to find a way to extract that ID (Maybe it can be done with a formula) and include it in update item action.
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!
Check out the community blog page where you can find valuable learning material from community and product team members!