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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Moderated Document App...
Power Automate
Unanswered

Moderated Document Approval

(0) ShareShare
ReportReport
Posted on by 4

I'm new to Flow and am trying to enable approvals using the standard SharePoint pattern of "requiring content approval for submitted items".

 

Everything works until the Approval task fails with a bad gateway error as follows:  "The current state of the item is Draft and the following action Approve cannot be implemented"

 

What type of patterns are required to use Flow approvals on moderated documents? Is this a bug or is updating the Approval Status of a document not supported in Flow? If it's not supported does Flow play any role in moderating content in SharePoint other than sending an email?  Is the best practice to merely use Flow to send an email?  

 

Categories:
I have the same question (0)
  • v-yuazh-msft Profile Picture
    Microsoft Employee on at

    Hi @ thastark1,

     

    Could you please share a screenshot of your flow’s configuration?

    Could you please show more details about your sharepoint library?

    Did you choose the option “Create major and minor (draft) versions” in the “Create a version each time you edit a file in this document library” field

     

    The error says you couldn’t set the Approve status when the item’s current state is Draft.

     

    If you choose the option “Create major and minor (draft) versions” in the “Create a version each time you edit a file in this document library” field, the same error would accur as yours when the flow run.

    You could choose the “Create major versions” in this field as screenshots below:

    aaaa.png

     

     

    I have made a test on my side to approve Sharepoint library file, the screenshots of my Sharepoint library as below:

     

     1.jpg

     

     

    The “file status” column is a choice type column, the column‘s value could be “Approved” , “Rejected” or “Pending” ,the column‘s default value is Pending.

    If your flow would be triggered when an item is created or modified, when the value of system field “Approval Status” is changed, the flow would be triggered again,

    you could add a “file status” column in the list as me to prevent this issue to accur.

     2.png

     

    You could create a flow following steps below:

    1. Add a trigger “When an item is created or modified (properties only)”, fill in your Site Address and Library Name.
    2. Add a Condition, the first value set to the “file status Value” dynamic content of the trigger, the second value set to “Pending”, the condition in the middle select “is equal to”.
    3. Inside the If yes branch of Condition, add action “Start an approval”, choose an Approval type, fill in the “Title” and “Assigned to” field.
    4. Add a Condition under the “Start an approval” action, the first value set to the Response dynamic content of “Start an approval” action, the second value set to “Approve”, the condition in the middle select “is equal to”.
    5. Add a Condition2, the first value set to the Response dynamic content of “Start an approval” action, the second value set to “Approve”, the condition in the middle select is equal to.
    6. Inside the If yes branch of Condition2,Add action “Update item”, fill in your Site Address and Library Name, fill in the ID dynamic content of the trigger in the “Id” Field, fill in the Title dynamic content of the trigger in the “Title” Field, choose Approved in the “file status Value” field.
    7. Add a “Get file metadata” action under the “Update item” action, fill in your Site Address, choose the “Identifier” dynamic content of “Update item” action in the “File Identifier” field.
    8. Add a “Set content approval status” action under the “Get file metadata” action, ”, fill in your Site Address and Library Name, choose the ID dynamic content of the trigger in the “Id” Field, choose Approve in the Action field, choose the “Comments” dynamic content of the “Start an approval” action, choose the “ETag” dynamic content of the “Get file metadata” action
    9. Inside the If no branch of Condition2,Add action “Update item2”, fill in your Site Address and Library Name, fill in the ID dynamic content of the trigger in the “Id” Field, fill in the Title dynamic content of the trigger in the “Title” Field, choose Rejected in the “file status Value” field.
    10. Add a “Get file metadata2” action under the “Update item2” action, fill in your Site Address, choose the “Identifier” dynamic content of “Update item2” action in the “File Identifier” field.
    11. Add a “Set content approval status2” action under the “Get file metadata2” action, ”, fill in your Site Address and Library Name, choose the ID dynamic content of the trigger in the “Id” Field, choose Reject in the Action field, choose the “Comments” dynamic content of the “Start an approval” action, choose the “ETag” dynamic content of the “Get file metadata2” action.

     

     

    Image reference:

     3.jpg4.jpg

     

    When a file is created in the library, the flow run successfully as below:

     5.jpg

     

    The screenshot of the new created file’s status in the Sharepoint library as below:

     6.jpg

     

     

    Note: The flow would work when a file is created in the library, I am afraid it is difficult for the flow to “Start an approve” with updated file in this situation, because the “Approval Status” and “file Status” of a file in the library would always be “Approved” or “Rejected”, you could not “Start an approve” with the file again.

     

     

     

    Regards,
    Alice Zhang

  • thastark1 Profile Picture
    4 on at

    The library configuration is the same however with Minor versions enabled.  The flow is triggered manually based on selected item.  If the document is in pending state I'm getting bad gateway errors.  The user checks in a major version and runs the flow. 

     

    When you enable Minor versions are approvals still working? If you remove the Etag is it still working?  

     

    Fixed using SP REST however the App Identity is used over user running flow which isn't desireable.

     

    I suppose I'm trying to understand if this is a bug or by design.

  • Brice235i Profile Picture
    651 on at

    Hi there, was this confirmed as a bug?  If on user voice can you add the link here so I can vote.  Thanks.

  • Thastark2 Profile Picture
    2 on at
    End users ultimately disabled Moderation so I was able to revert to OOTB Flow. Having said this my coworker did not experience the same behaviour on a different tenant so I presume it is a bug.
  • Brice235i Profile Picture
    651 on at

    Thank you!  I received the Bad Gateway error with minor and major versioing enabled on the library.  When I switched to major versions no probs...  yes probably a bug.  I have raised with Microsoft.  Thanks so much for this post!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 103 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 87

#3
trice602 Profile Picture

trice602 63 Super User 2026 Season 1

Last 30 days Overall leaderboard