cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger for when document in SharePoint is published to a major version

I have been working on an approval flow for a document library in SharePoint of late, and there is one thing I wish was available:

My library has minor/major versions enabled as well as Content Approval. Now, what I wish I had available in Flow is a trigger that fires when a document is submitted for approval and/or when a document has been published for a new major verison (these two scenarios are more or less the same thing I guess).

 

Reason for this wish/request:

In my approval flow I had to do a Http Request to SharePoint to find out if the Moderation Status was the right value. I couldn't start it unless the value was equal to 2 (which is Pending) and this isn't exactly very sexy. It would be better if there was a trigger that only fired when Moderation Status eq 2.

 

Hope this is something that will be considered. I feel confident that I'm not the only one that would like to see such a feature in Flow.


Thanks!

Status: New
Comments
DuvetMan
Regular Visitor

I am really frustrated that this is not available. MS seems to think that the only documents that get added to a policy or procedure document store are new ones. As far as i can see it is immpossible to get a flow to trigger when a sharepoint document changes its approval status to pending.

 

It would be so much easier to have a flow trigger based on the sharepoint version control settings.

 

Instead we are required to use sharepoint designer which MS say is not longer being developed.

 

If i am wrong i would love to know how to trigger a document based on its document status

Akash2505
New Member

@contains(triggerBody()?['VersionNumber'], '.0'.

 

Put this in trigger condition and I guess this is your answer

SchneidAIR
Advocate III

This would be the correct workaround for a Trigger-Condition to start only on Publishing Major Versions:

 

 

@contains(triggerBody()?['{VersionNumber}'],'.0') 

 

but it would be better to use the Lists/Libraries Content Approval Feature with the Pending Status

 

 

@equals(triggerBody()['{ModerationStatus}'],'Pending')

 

 

 

 

abitely
Regular Visitor

@SchneidAIR forgive the basic question, but how specifically would you implement your suggestion?

SchneidAIR
Advocate III

In the SharePoint Trigger Settings of your flows you can use the Trigger Start Conditions.

You must enable Content Approval on your Library. Then you have Content Approval Status Column {ModerationStatus}.

 

Then the Flow gets only triggered, when Content Approval Status is submitted for pending Approval (= Publish Major Version)

 

SchneidAIR_0-1603108242550.png

 

abitely
Regular Visitor

@SchneidAIR thank you for replying and the additional explanation. I did a quick test and this worked! Thank you very much, this is a huge help!

abitely
Regular Visitor

@SchneidAIR interestingly, I found a slight issue. If you publish and then approve too quickly, the automatic trigger will not activate in time. I counted and it consistently takes about 15 seconds for the automatic flow to trigger once an item moves to "pending".... but otherwise, this does seem to work

SchneidAIR
Advocate III

@abitely Power Automate Flow is not a Real Time Workflow Engine.

The Approval should be made from Flow Actions, not manual.

You could use the ETag to Set the Content Approval Status (Moderation State) from the File after the "Create and Wait for Approval" Actions...

 

ETag.png