Microsoft Flow and document lifecycle for approving major versions

Iron Contributor

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.

28 Replies
Hi Jeremy, I will do my best to get you an answer to this question. :)

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

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

 

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

Are there any updates on this? A very wanted feature.

@Eric_Hthe link is invalid,  it says "An invalid set of parameters has been specified in the url."

 

The URL does indeed keep changing for some reason. You can search the community for Chris McNulty's post titled "Reinvent business process in Sharepoint and Onedrive".  

 

Here's an updated link, but not sure if it will last:  https://techcommunity.microsoft.com/t5/SharePoint-Blog/Reinvent-business-process-in-SharePoint-and-O...

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?

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.

You first have to "submit/publish" it from draft to pending for approval afterwards you can approve or reject. Unfortunately approve or reject has no impact #Bug I raised a support ticket last week. Feel free to reference it.

 

Regards Christian

@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

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

 

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

Similar to Mark's question / situation.

I can do an approval based on the assumption the file is new or someone has edited it in the library so the approval status is reset to Pending.

 

But what about situations where the doc owner gives the file a surface review, makes no changes and simply wants to re-approve / reset the document review date. It would be great if I could wrap these teo scenarios into the same flow with a check against current approval status. But it looks like I'm going to have to build 2 flows for each, and work off another column, or automatically update a metadata column to force a Pending state then send for re-Approval.

 

Is my take on this still accurate? Still cannot look up the selected files approval state via a condition?

Cheers

To update myself.... looking at a REST call on item get _ModerationStatus and see if I can check the current status via REST then apply this to a condition. So if current status = Approved = reapprove, else regular approval flow. 

To assist anyone - using the SP api of GetByTitle combined with the method of calling your tenant/site/library with a client secret etc allows you to send a GET of

 

yoursite.sharepoint.com/sites/Sitename/_api/lists/GetByTitle('MyWorkFlowLibrary')/items('docID')/ODa...

 

You can then assess the current status of the object approval with the following -

Approved, //0
    Denied,   //1
    Pending,  //2
    Draft,    //3
    Scheduled //4

run a condition against that and then keep a basic 're-approval' in the same flow as a full on new doc approval.

Hope this helps.. 

In my use case I am not using documents. Does this work on Lists for items with content approval turned on? I can't seem to get this to work no matter what I try. I used the REST call to obtain the metadata and Etag of the item. Then attempted to use the "Set content approval status" control. Just can't get past this kind of error.... 

"The current state of the item is Approved and the following action Submit cannot be implemented"

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

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.

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.


@Robert Caretta wrote:

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.


Can you explain what you mean by cannot change it once approved?