web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / 502 bad gateway in "Se...
Power Automate
Unanswered

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,



Categories:
I have the same question (0)
  • Verified answer
    annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

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

     

     

  • Jean_9681 Profile Picture
    135 on at

    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“.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard