How to set Content approval status with Power Automate
Posted On October 10, 2021
“When I use the Set Content Status Approval action to change the approval status to Approved, the Power Automate flow just hangs there with a Bad Gateway error on that action”
If you decide that the simple content approval in SharePoint is not enough, you can replace it with Power Automate flow. And in that flow you’ll use the ‘Set content approval status’ to update the status at the end. You probably won’t encounter any problems if a SharePoint library allows only major versions. But once you allow minor versions, the action can cause problems. The action might end with “BadGateway” and the whole flow will fail.
What’s the problem?
When setting the content approval status, it must go in a specific order. The document starts as ‘Draft’. Once it’s submitted for approval, it’ll go into ‘Pending’ status. From there it can be ‘Approved’ or ‘Rejected’. You can’t skip the order. If document is in ‘Draft’, you can’t approve nor reject it directly. It must be in the ‘Pending’ status before that.
That’s very often the problem. If you’re building your own approval flow, you must go through all the states. Don’t approve/reject directly, set the status ‘Pending’ with the ‘Submit’ action first.
Document update in the flow
It’s not only at the beginning of the flow to inform users, you should update the status after each update. If you enable content approval and minor versions, then each update will turn the document back to ‘Draft’. Even updates by Power Automate. And as already explained above, you can’t approve/reject document directly from ‘Draft’ status. The content approval process must always follow the same steps: Draft -> Pending -> Approved/Rejected. Translated to the ‘Set content approval status’ action: (create/update) -> Submit -> Approve/Reject.
If you use Power Automate flow to replace the standard content approval process, you must follow the status order. If document is in status ‘Draft’, you must ‘Submit’ it for content approval. Only documents in ‘Pending’ status can be approved or rejected. And the important point – each update in the flow will turn the document back into ‘Draft’. That means you must set it back to ‘Pending’ before the final approval/rejection.