Forum Discussion

Jeremy Thake's avatar
Jeremy Thake
Iron Contributor
Dec 09, 2016

Microsoft Flow and document lifecycle for approving major versions

Is there any guidance on how to use Flow to manage document lifecycle with published versions with multiple approvals? This would require the option to trigger the flow from the drop down for a document in the document library. Flow on approval would set a new major version and publish it. Something frequently done in the past with SharePoint Designer.

  • Cathy Dew's avatar
    Cathy Dew
    Copper Contributor
    Hi Jeremy, I will do my best to get you an answer to this question. :-)
      • Eric_H's avatar
        Eric_H
        Iron Contributor

        I believe an announcement at Ignite 2017 covers this.  I too have been looking for a way to use Flow to approve and publish documents in a library, similar to the old 2010 build in publishing features where it could take a minor version, get approved, and publish it as a major version.  

         

        See "custom approval action" listed here and on other ignite summary announcements:

        https://techcommunity.microsoft.com/t5/SharePoint-Blog/Reinvent-business-process-in-SharePoint-and-OneDrive/ba-p/109490 

         

        Chris McNulty, do you have any articles detailing this feature, or maybe an ignite session that demo'd it?  Also, can you say if it will support tracking the approver?  One thing that the old "publish" feature couldn't do was track who and when a particular document was approved (for auditing purposes).  This is even a bit of a challenge in 3rd party workflow tools.  This is a critical piece I'm hoping we'll be able to tap into when "custom approval actions" comes out.  

    • Mark Stokes's avatar
      Mark Stokes
      Copper Contributor

      Hi Cathy Dew.

       

      Are there any updates to this?  I am creating a Logic App at the moment where I need to publish documents. 

       

      At the moment, they get uploaded as 0.1, my logic app updates their properties to 0.2 but I need them to be at 1.0 for users to actually see them.

       

      At the moment it looks like I need to call an Azure Function to perform this step, but I REALLY want to avoid that.

       

      Thanks

       

      Mark

       

      cc/ Jeremy Thake - Did you find another way to perform this action?

      • roykim's avatar
        roykim
        MVP

        I am also trying to publish a document by using a flow action "Set content approval status".

        The document is in draft state.

         

        I get an error the flow debugger

        {
          "message""The current state of the item is Draft and the following action Approve cannot be implemented\"\r\nclientRequestId: fdb16f40-8072-400b-xxxxxxx",
          "status"502,

         

        Appreciate any guidance.

  • Audrie Gordon's avatar
    Audrie Gordon
    Brass Contributor

    Re: set a major version and publish it:

    I believe that flow can not select and act on system intenal fileds, so this is not available at this time.

     

    Re: trigger a flow from the drop down of a document in the document library

    I had a similar requirement, and I found this workaround which is basically create a trigger that can be surfaced. See this blog:

    http://blog.repsaj.nl/index.php/2016/10/o365-using-sharepoint-boolean-fields-with-microsoft-flow/

     

    Hope this helps,

    Audrie

  • Jeremy Thake the new "Set content approval status" action should do it. But only works partially. It works when you use "submit" to get from draft to pending, but it will not do anything when you try to approve or reject. This seems to be a bug. 

    Cheers

    Christian

    • roykim's avatar
      roykim
      MVP

      Jeremy Thake Christian Glessner

       

      I got it working the other day and thanks for the comments.

       

      Upon Item selected trigger, I set content approval status to submit.

      After approval action, I set content approval status to 'approve', but the trick is to click on 'advanced' and you will see a field to enter ETag. So add the ETag that is the output of the first content approval status action. 

      Therefore, document becomes approved in the doc library.

       

      There should be a new trigger when from the Doc Library, when a user submits a doc for content approval. Thank you again.

      • Mark Stokes's avatar
        Mark Stokes
        Copper Contributor

         

        My situation is a little different. I am not looking at Content Approval. I simply want to publish a major version of my document. i.e.  v1.0

  • You should be able to build a document approval flow using the 'Set content approval status' action. This works with the SharePoint content approval feature. Here is my blog post that shows how to build this flow for a document library: https://www.chakkaradeep.com/2018/03/12/require-approval-of-documents-in-sharepoint-using-microsoft-flow/

    You can also use this to approve list items, however, the ETag is something you don't need for list items while its required for documents when you manage the content approval status.
    • Robert Caretta's avatar
      Robert Caretta
      Copper Contributor

      Yes I was able to get this working. The wrinkle is once it's approved, you can not change it with the workflow. It always throws an error.

Resources