Using Power Automate for document publishing approval

Copper Contributor

I have a unique use case for using Power Automate to publish a document in SharePoint.  We have 2 levels of approval for each document: a document owner and a library approver.  With each approval, we are capturing the approver comments.  The business wants the comments to be included with the document approval in the metadata.  I am using a multi-line text column where we are appending the history.  One of the challenges that I ran into was that I could not write the comments to the metadata column during the approval process as it would cancel the approval flow - since the file was updated.  To get around this restriction, I captured the comments in a variable, then I write the metadata AFTER the file has been published.  The problem is that it takes my published file and changes it to draft as it has been updated.  It was suggested that I try to re-publish the document after updating the metadata.  However, I cannot publish the document from a draft status.  It needs to be pending.  I don't see a way to programatically set the approval status back to pending.

 

Does anyone have any ideas on how I can keep the approval comments as part of the document and show the document as published?

3 Replies

Hi @John_Ravas_Schdy 

 

Can you please show us what your flow looks like (perhaps from the point where the issue begins to occur though if you can show all that would help)? A visual may help us to pinpoint the issue.

 

Cheers

Damien

Hi @Damien Rosario Thank you for the reply.  Attached are 2 parts of my flow.

Part 1 is the where the flow picks up right after the second person approves.  First it publishes the document by setting the approval status to approve. 

Part 2 continues the flow by taking the approval comments that I have queued up in a variable and updates the document metadata.  Our team wants those comments saved for the auditors.  When that step completes, it updates the version to x.1 and sets the approval status back to draft.   This is confusing to our users because they just submitted the document for approval. 

 

In the final flow action, I attempt to set the publish approval status back to approve.  However, it bombs because we are trying to take the approval status from draft directly to approve without first going to pending. 

 

I hope that makes sense.

 

JR 

@John_Ravas_Schdy 

Hi, I do this in my Content Approval flow, but it's set up a different way from yours.  I don't use any variables and my flow never gets cancelled because of an update.  I also have multiple approvals.

My first approval is for QC and puts the document into Pending status in SharePoint.

My second approval is for actual approval and puts the document into Approved status in SharePoint.

Here is how I handle the comments:

 

Approval action

Condition if approval = Approved

YES

If Content Approval Status = Pending

check out file

check in file to draft

Get file metadata

Set content approval to pending, and I enter here the comments I want to be placed automatically into the version history.  You can include fixed text but also include the field to enter the comments that the approver types into the power automate flow when they hit the approve button.

Set content approval to Approved, and here I enter the comments I want to show up in the metadata column.

 

How the set content approval action works is that when you set it to draft or pending it puts the comments into the version history.  When you set it to approve or reject it puts the comments into the column metadata of the library.

 

By checking out the file and checking it back in as draft, then re-setting the published action, you can put it to pending yourself and control the comments.