cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RachelRig
Advocate V
Advocate V

502 Bad Gateway - Set Content Approval action fails on exactly the thing it is intended to do

I have a Flow running on a SPO list with content approval enabled. There is no approval task -- only the action to Set Content Approval. My flow has to update some metadata, which of course sets the Approval Status to Draft. I thought I could use the Set Content Approval action in Flow to force the status back to Approved. (I do have the Get File Metadata action in place immediately beforehand and the Etag is set.) But I get this error:

 

{
"error": {
"code": 502,
"source": "flow-apim-msmanaged-na-westus2-01.azure-apim.net",
"clientRequestId": "ae99f1e8-a0e1-4b37-8f4a-6207da707c04",
"message": "BadGateway",
"innerError": {
"status": 500,
"message": "The current state of the item is Draft and the following action Approve cannot be implemented\"\r\nclientRequestId: ae99f1e8-a0e1-4b37-8f4a-6207da707c04\r\nserviceRequestId: ae99f1e8-a0e1-4b37-8f4a-6207da707c04"
}
}
}
 
So the flow updates my file properties, but then will not set the Approval Status because it's in Draft?? Even back in SP Designer, I could force the Approval Status back to where I needed it to be. Does anyone know how to make this work? 
 
(Please note, the Flow was running fine before the Set Content Approval action was added. No bad gateways prior to that change.)
1 ACCEPTED SOLUTION

Accepted Solutions
Laslo
Frequent Visitor

Hello,

 

Try to submit before approve :

 

satut-1.PNG

statut-3.PNG

View solution in original post

5 REPLIES 5
rimatos
Microsoft
Microsoft

Hi @RachelRig ,

 

Would it be possible to provide a print of the full Flow, and show how you are trying to Set Content Approval Status? You need to set Status = Submit.

 

It could be possible that you would need to preform this action in another stage of the Flow, hence it not working as expected.

 

Alternatively, if you can always open a ticket to Microsoft Support through here: https://admin.powerplatform.microsoft.com/support if this requires a more in depth Troubleshooting.

 

 

I hope this post helped you move forward!

 

Regards,

Ricardo

GetFileMeta.PNG

Thank you for your reply.  I'm not sure how to get a full print out of the Flow.  The action I named "set flags back to 0" is an Update File Properties action.  This is an eternal problem I have wrestled with for years. I need to automate the updating of certain file properties with a workflow -- but this conflicts with Content Approval because there is no way to get around the movement back to Draft status. It would be amazing if SharePoint or Flow allowed developers some way around this -- but if not, at least let me force the system-generated Approval Status (Moderation Status) back to Approved after my property updates are done.  I assumed that the Action field here should be set to "Approve" -- but I will try it with "Submit" as you suggest.

 

In another discussion thread from 2018, I saw a Microsoft employee telling someone that the Set Content Approval action is not supported for SharePoint. Don't know if that is accurate, but many people seem to be having trouble with SharePoint content approval. It makes no sense that Flow has an action that is SharePoint-specific and is named "Set Content Approval Status" -- but that somehow has no relationship to the content approval status. (?!?) What is it for then?  Is there some trick I am missing?

Hi @RachelRig ,

 

I found this solution in several online posts which could prove to be useful to you as well:

 

https://techcommunity.microsoft.com/t5/powerapps-flow/microsoft-flow-and-document-lifecycle-for-appr...

&

https://www.chakkaradeep.com/2018/03/12/require-approval-of-documents-in-sharepoint-using-microsoft-...

 

On both of them when facing the same error message as you did the solution was to change it to submit so i think its worth a try.

 

 

As for the Set content approval not being supported by SharePoint i believe this is a misunderstanding. If you read our internal documentation on this action of the connector you can read the following:

 

"This action is only available for SharePoint Online and SharePoint 2019"

 

So i would assume that maybe this was the point of my colleague when explaining this point.

 

 

As for the issue with automating the update of file properties with Flow and the conflict with Content Approval, if you like to have this feature implemented you can suggest it in Power Automate Ideas Forum this way if it gets enough upvotes the Product Group will take a look at your request and see if its something they can implement.  I can assure you that they do indeed look at this since they are constantly bringing new updates to both Power Automate and Power Apps and they get many of their suggestions from here.

 

If you like you can share the idea here and I can upvote it to help spread this request.

 

Hope this information was useful to you!

 

Regards,

Ricardo

Laslo
Frequent Visitor

Hello,

 

Try to submit before approve :

 

satut-1.PNG

statut-3.PNG

View solution in original post

Thank you, Ricardo! I finally got it figured out. So you were saying I need to Submit first -- and that put the doc into Pending status. Then I had to repeat the Get File Metadata - Set Content Approval Status pattern a second time to go from Pending to Approved. It's a lot of steps, but it works!

 

Now, I have to add yet another "flag" column to my library so that I can stop this workflow from running in an infinite loop.  Thank you very much for your help.

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (39,774)