I have a Power Automate running on an SPO library with content approval enabled. There is an approval workflow and the trigger condition is to start the workflow when the approval status is set to Pending when the file/document is checked in.
I am using the Set Content Approval action to update the status based on the approval outcome.
My workflow also updates some metadata after the approval process, which of course sets the Approval Status to Draft. The workflow updates my file properties, but then will not set the Approval Status because it's in Draft
The workflow fails with this error
"error": {
"code": 502,
"source": "flow-apim-msmanaged-na-northcentralus-01.azure-apim.net",
"clientRequestId": "*********************************",
"message": "BadGateway",
"innerError": {
"status": 500,
"message": "The current state of the item is Draft and the following action Approve cannot be implemented\"\r\nclientRequestId: 763afee4-db00-491f-9e31-f52216c524d1\r\nserviceRequestId: 763afee4-db00-491f-9e31-f52216c524d1"
}
Most of the suggestions posted in support blogs/forums are to include/ add a Set Content Approval Action and set the Status to Submit. In my case, if I do this then the workflow gets triggered again and I end up in a loop.
So was wondering if there is any way to fix this issue using the Send HTTP action to change the status to approved/rejected based on the approval outcome.
This is what I got so far and had no luck
I ended up with this error
The type SP.ListItemEntityCollection does not support HTTP PATCH method.
clientRequestId: **********-b138-4c9b-8052-************
serviceRequestId: *******-5067-c000-6321-**********
If i change the Method to Post i get this error
A type named 'SP.Data.ListnameItems' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.
I am not sure if an doing it right or trying something that is not doable,
Any suggestions on how to get this working.
Thank you,
Thank you, this helped me fix my issue.
@not(equals(triggerBody()?['Editor']?['Email'], 'serviceaccountemailaddress'))
But then when we add two Set content approval status - one for submit and one for approved
I ended up with this error "Conflict "
To fix this problem I just had to select/change the “ETag” value from previous “Set content approval status” which action value is “Submit“.
@Jean_9681 i think you will get the same error if you try to update status using Send HTTP action, do you have both major and minor versions enabled on your library? If yes, first you will need to set status to submit and then to approved. To avoid ending up in loop for submit and approve, put trigger condition on your flow trigger, check for user in modified by field. Here if you use service account for SharePoint actions connection, then you can check in trigger condition that if Editor is not service account, then only the flow will trigger.
Below is example of trigger condition
@not(equals(triggerBody()?['Editor']?['Email'], 'serviceaccountemailaddress')
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1