cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
twinter917
New Member

Delay Automated Approval Flows Until Document is Closed

Is there a way to delay an automated flow I have created for approving documents in SharePoint to only trigger once a file is created or modified, and in the instance of it being modified, the file is closed or saved?  I am running into an issue where users are updating a file in Excel Online and every few minutes after the Excel file saves again, it is generating another approval request.

 

In short, is there a way for when a file is being modified, for an automated flow not to trigger until either:

  1. The document is closed;
  2. A user clicks 'Save'; or
  3. The document is inactive for a specified time frame?

 

I would like to avoid switching to an instant flow as that will likely lead to users not remembering to send documents for approval, and keeping documents in limbo until they are approved.  

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
twinter917
New Member

UPDATE

 

I figured out the fix.  The trigger condition should be:

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

 

twinter917_0-1620941367979.png

 

I tested it after that and it appears to be working as intended.  The flow is not being triggered as long as the document is in 'Draft' status, and only fires once the document is published/submitted for approval.

View solution in original post

5 REPLIES 5
JisungHan
Community Support
Community Support

Hi @twinter917 ,

 

There is no way to prevent this session that is opening from the Excel online by Power automate. 

Even there is no way to disable auto-saving from Excel Online. The following answer is from Office support team side:

JisungHan_0-1620791067743.png

https://answers.microsoft.com/en-us/msoffice/forum/msoffice_o365admin-mso_shareon-mso_o365b/how-to-d... 

There are three considerable ways:

1. Inform the users to upload the file after updating in PC not use Excel online directly

2. Trigger the Power automate when a document is created

3. Add one option field in the SharePoint document library and trigger when the field value is updated manually by end users after update the Excel file.


Hope this helps. Thanks!

 

Best regards,
Jisung Han

twinter917
New Member

Hi @JisungHan, thank you for getting back to me.  I did enable minor draft versions, which populates a button on the ribbon "Submit for approval". 

 

Ribbon.PNG

Document Draft.PNG

I assume this is referring to the deprecated SharePoint approval workflow?  Either way, the document appears to remain in "Draft" status while the document is open, regardless of it autosaving, until that button is clicked which changes the approval status to "Pending".  Is there a way to add an expression under trigger conditions so that the trigger only fires when the Approval Status is set to "Pending"?  It seems that without this condition, it will still fire even when in "Draft" status.  

 

Thanks again for your help!

Hi @twinter917 ,

 

The following triggering condition can be added:

 

@equals(triggerBody()?['ColumnName'],'Draft')

 

JisungHan_0-1620805326339.png

https://global-sharepoint.com/sharepoint-2/trigger-power-automate-flow-based-on-condition-in-sharepo...

 

https://www.c-sharpcorner.com/article/flow-trigger-conditions-for-sharepoint-run-flow-when-needed/

 

You may refer the references above.

 

Hope this helps. Thanks!

 

Best regards,
Jisung Han

 

 

twinter917
New Member

Good morning @JisungHan, thank you again for the quick reply.

 

Would it be 

@equals(triggerBody()?['ApprovalStatus'],'Draft')

or

@equals(triggerBody()?['ApprovalStatus'],'Pending')

if I only want it to run when the Approval Status column says 'Pending'?

 

I tried both ways, and now the flow is not triggering.  For the column name I tried both 'ApprovalStatus' and 'Approval Status'.

 

For the Split On array, I do not have 

@triggerBody()?['value']

I have 

@triggerOutputs()?['body/value']

or 

@triggerBody()?['body/SharedWithUsers']

 And since I switched it to the body/SharedWithUsers, I lost the other option...

twinter917
New Member

UPDATE

 

I figured out the fix.  The trigger condition should be:

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

 

twinter917_0-1620941367979.png

 

I tested it after that and it appears to be working as intended.  The flow is not being triggered as long as the document is in 'Draft' status, and only fires once the document is published/submitted for approval.

View solution in original post

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,309)