Using Power Automate for document publishing approval

%3CLINGO-SUB%20id%3D%22lingo-sub-1207543%22%20slang%3D%22en-US%22%3EUsing%20Power%20Automate%20for%20document%20publishing%20approval%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1207543%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20unique%20use%20case%20for%20using%20Power%20Automate%20to%20publish%20a%20document%20in%20SharePoint.%26nbsp%3B%20We%20have%202%20levels%20of%20approval%20for%20each%20document%3A%20a%20document%20owner%20and%20a%20library%20approver.%26nbsp%3B%20With%20each%20approval%2C%20we%20are%20capturing%20the%20approver%20comments.%26nbsp%3B%20The%20business%20wants%20the%20comments%20to%20be%20included%20with%20the%20document%20approval%20in%20the%20metadata.%26nbsp%3B%20I%20am%20using%20a%20multi-line%20text%20column%20where%20we%20are%20appending%20the%20history.%26nbsp%3B%20One%20of%20the%20challenges%20that%20I%20ran%20into%20was%20that%20I%20could%20not%20write%20the%20comments%20to%20the%20metadata%20column%20during%20the%20approval%20process%20as%20it%20would%20cancel%20the%20approval%20flow%20-%20since%20the%20file%20was%20updated.%26nbsp%3B%20To%20get%20around%20this%20restriction%2C%20I%20captured%20the%20comments%20in%20a%20variable%2C%20then%20I%20write%20the%20metadata%20AFTER%20the%20file%20has%20been%20published.%26nbsp%3B%20The%20problem%20is%20that%20it%20takes%20my%20published%20file%20and%20changes%20it%20to%20draft%20as%20it%20has%20been%20updated.%26nbsp%3B%20It%20was%20suggested%20that%20I%20try%20to%20re-publish%20the%20document%20after%20updating%20the%20metadata.%26nbsp%3B%20However%2C%20I%20cannot%20publish%20the%20document%20from%20a%20draft%20status.%26nbsp%3B%20It%20needs%20to%20be%20pending.%26nbsp%3B%20I%20don't%20see%20a%20way%20to%20programatically%20set%20the%20approval%20status%20back%20to%20pending.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20anyone%20have%20any%20ideas%20on%20how%20I%20can%20keep%20the%20approval%20comments%20as%20part%20of%20the%20document%20and%20show%20the%20document%20as%20published%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1207543%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFile%20Approvals%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1210334%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Power%20Automate%20for%20document%20publishing%20approval%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1210334%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F270031%22%20target%3D%22_blank%22%3E%40John_Ravas_Schdy%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20please%20show%20us%20what%20your%20flow%20looks%20like%20(perhaps%20from%20the%20point%20where%20the%20issue%20begins%20to%20occur%20though%20if%20you%20can%20show%20all%20that%20would%20help)%3F%20A%20visual%20may%20help%20us%20to%20pinpoint%20the%20issue.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheers%3C%2FP%3E%3CP%3EDamien%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1214322%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Power%20Automate%20for%20document%20publishing%20approval%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1214322%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F89704%22%20target%3D%22_blank%22%3E%40Damien%20Rosario%3C%2FA%3E%26nbsp%3BThank%20you%20for%20the%20reply.%26nbsp%3B%20Attached%20are%202%20parts%20of%20my%20flow.%3C%2FP%3E%3CP%3EPart%201%20is%20the%20where%20the%20flow%20picks%20up%20right%20after%20the%20second%20person%20approves.%26nbsp%3B%20First%20it%20publishes%20the%20document%20by%20setting%20the%20approval%20status%20to%20approve.%26nbsp%3B%3C%2FP%3E%3CP%3EPart%202%20continues%20the%20flow%20by%20taking%20the%20approval%20comments%20that%20I%20have%20queued%20up%20in%20a%20variable%20and%20updates%20the%20document%20metadata.%26nbsp%3B%20Our%20team%20wants%20those%20comments%20saved%20for%20the%20auditors.%26nbsp%3B%20When%20that%20step%20completes%2C%20it%20updates%20the%20version%20to%20x.1%20and%20sets%20the%20approval%20status%20back%20to%20draft.%26nbsp%3B%20%26nbsp%3BThis%20is%20confusing%20to%20our%20users%20because%20they%20just%20submitted%20the%20document%20for%20approval.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20final%20flow%20action%2C%20I%20attempt%20to%20set%20the%20publish%20approval%20status%20back%20to%20approve.%26nbsp%3B%20However%2C%20it%20bombs%20because%20we%20are%20trying%20to%20take%20the%20approval%20status%20from%20draft%20directly%20to%20approve%20without%20first%20going%20to%20pending.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20hope%20that%20makes%20sense.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJR%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1631557%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Power%20Automate%20for%20document%20publishing%20approval%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1631557%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F270031%22%20target%3D%22_blank%22%3E%40John_Ravas_Schdy%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%2C%20I%20do%20this%20in%20my%20Content%20Approval%20flow%2C%20but%20it's%20set%20up%20a%20different%20way%20from%20yours.%26nbsp%3B%20I%20don't%20use%20any%20variables%20and%20my%20flow%20never%20gets%20cancelled%20because%20of%20an%20update.%26nbsp%3B%20I%20also%20have%20multiple%20approvals.%3C%2FP%3E%3CP%3EMy%20first%20approval%20is%20for%20QC%20and%20puts%20the%20document%20into%20Pending%20status%20in%20SharePoint.%3C%2FP%3E%3CP%3EMy%20second%20approval%20is%20for%20actual%20approval%20and%20puts%20the%20document%20into%20Approved%20status%20in%20SharePoint.%3C%2FP%3E%3CP%3EHere%20is%20how%20I%20handle%20the%20comments%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EApproval%20action%3C%2FP%3E%3CP%3ECondition%20if%20approval%20%3D%20Approved%3C%2FP%3E%3CP%3EYES%3C%2FP%3E%3CP%3EIf%20Content%20Approval%20Status%20%3D%20Pending%3C%2FP%3E%3CP%3Echeck%20out%20file%3C%2FP%3E%3CP%3Echeck%20in%20file%20to%20draft%3C%2FP%3E%3CP%3EGet%20file%20metadata%3C%2FP%3E%3CP%3ESet%20content%20approval%20to%20pending%2C%20and%20I%20enter%20here%20the%20comments%20I%20want%20to%20be%20placed%20automatically%20into%20the%20version%20history.%26nbsp%3B%20You%20can%20include%20fixed%20text%20but%20also%20include%20the%20field%20to%20enter%20the%20comments%20that%20the%20approver%20types%20into%20the%20power%20automate%20flow%20when%20they%20hit%20the%20approve%20button.%3C%2FP%3E%3CP%3ESet%20content%20approval%20to%20Approved%2C%20and%20here%20I%20enter%20the%20comments%20I%20want%20to%20show%20up%20in%20the%20metadata%20column.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20the%20set%20content%20approval%20action%20works%20is%20that%20when%20you%20set%20it%20to%20draft%20or%20pending%20it%20puts%20the%20comments%20into%20the%20version%20history.%26nbsp%3B%20When%20you%20set%20it%20to%20approve%20or%20reject%20it%20puts%20the%20comments%20into%20the%20column%20metadata%20of%20the%20library.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBy%20checking%20out%20the%20file%20and%20checking%20it%20back%20in%20as%20draft%2C%20then%20re-setting%20the%20published%20action%2C%20you%20can%20put%20it%20to%20pending%20yourself%20and%20control%20the%20comments.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional 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
Highlighted

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 

Highlighted

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