Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

502 bad gateway in "Set content approval status"

(0) ShareShare
ReportReport
Posted on by 135

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

 

Jean_9681_0-1628205724743.png

 

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,



  • Jean_9681 Profile Picture
    135 on at
    Re: 502 bad gateway in "Set content approval status"

    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 "

    Jean_9681_0-1628526114195.png


    To fix this problem I just had to select/change the “ETag” value from previous “Set content approval status” which action value is “Submit“.

  • Verified answer
    annajhaveri Profile Picture
    8,531 Most Valuable Professional on at
    Re: 502 bad gateway in "Set content approval status"

    @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')

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1