cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
chrismanncg
Level: Powered On

Duplicate approval for Sharepoint files when modified

Hi there,

I have a flow i'm working on based on the template When a file is added, approve file using Sharepoint content approval. However i've modified the trigger to be When a file is created or modified (properties only).

All works well however 5 minutes after running the approval, there is a second approval email sent out which duplicates the first one.

If this approval is done a second time, no problems occur and all works fine but it's a nuisance.

Any ideas why this might be?

Thanks.

Chris

 

1 ACCEPTED SOLUTION

Accepted Solutions
chrismanncg
Level: Powered On

Re: Duplicate approval for Sharepoint files when modified

Finally found a good solution, takes time to implement but thanks to the person responsible!

 

https://powerusers.microsoft.com/t5/General-Flow-Discussion/Reading-Approval-Status/m-p/199210

10 REPLIES 10
Super User
Super User

Re: Duplicate approval for Sharepoint files when modified

@chrismanncg 

Does this template modify the file properties in your library?

If so, then flow is executed twice, first when fil is added, then when file is modified. You can potentially enter a neverending loop

Hope this helps





If anybody solved your question, remember to mark its post as a solution!

Proud to be a Flownaut!





chrismanncg
Level: Powered On

Re: Duplicate approval for Sharepoint files when modified

Thanks for the comment. I can confirm there is no endless loop, it only happens twice.

 

The final action taken on the item is "Set content approval status to approve" which happens as a result of the approval flow, nothing else.

All works correctly apart from the double emails, strange.

Super User
Super User

Re: Duplicate approval for Sharepoint files when modified

@chrismanncg 

I have been looking at the template, and I guess you are using the same Library NAme for both the trigger and the following actions: "Set content pproval status to approve" and "Set content approval status to reject" right?

If so, when approval/rejection is received, your Flow is modifyig file properties on the Sharepoint library, and flow is triggered again. If you approve/reject the second approval, Flow will trigger again.

 

I guess when someone adds a new file to the library, its "Action" property will be set to "Submit" by default, right? If so I suggest you to add a condition just after the trigger to evaluate "Action". If value is "Submit", terminate the flow, if not, continue processing.

 

The new condition to evaluate should be:

equals(triggerBody()?['Action'],'Submit')
 
Hope this helps
 
flow_template_loop.png
 

 

 





If anybody solved your question, remember to mark its post as a solution!

Proud to be a Flownaut!





chrismanncg
Level: Powered On

Re: Duplicate approval for Sharepoint files when modified

Thanks for that. I tried the suggestion however "Action" does not appear within any of the available variables from the other objects. After manually typing it in and running the flow, the expression always evaluates to false every time.

Super User
Super User

Re: Duplicate approval for Sharepoint files when modified

@chrismanncg 

"Action" seems to be a column that should be available in your Sharepoint Library, it helps you to store the status value of each File Approval. It seems to be of type "Choice" with three different values.

Hope this helps

 

 

 





If anybody solved your question, remember to mark its post as a solution!

Proud to be a Flownaut!





chrismanncg
Level: Powered On

Re: Duplicate approval for Sharepoint files when modified

Finally found a good solution, takes time to implement but thanks to the person responsible!

 

https://powerusers.microsoft.com/t5/General-Flow-Discussion/Reading-Approval-Status/m-p/199210

angger_aa
Level: Powered On

Re: Duplicate approval for Sharepoint files when modified

@chrismanncg 

Can you explain more, how to implement this solution into trigger "When a file is created or modified (properties only)" ?

Where it should put?image.png

 

Thanks

chrismanncg
Level: Powered On

Re: Duplicate approval for Sharepoint files when modified

I believe it should work, just change your "Output" variable in the code the reference the "ID" of the new trigger for the file object.

 


@angger_aa wrote:

@chrismanncg 

Can you explain more, how to implement this solution into trigger "When a file is created or modified (properties only)" ?

Where it should put?image.png

 

Thanks


 

angger_aa
Level: Powered On

Re: Duplicate approval for Sharepoint files when modified

Update:

@chrismanncg 

I've made the flow to be like this

image

 

But the result condition which get the "Approval Status" is always False.

Am I wrong or missed something?

 

Thanks

 

=========================================================

Sorry, I do not understand yet for this issue.

FYI, I've been created the flow like this

 

 Do I have to create a new flow for the solution "just change your "Output" variable in the code the reference the "ID" of the new trigger for the file object." ?

Or how to implement the solution?

 

Thanks

 


@chrismanncg wrote:

I believe it should work, just change your "Output" variable in the code the reference the "ID" of the new trigger for the file object.

 


@angger_aa wrote:

@chrismanncg 

Can you explain more, how to implement this solution into trigger "When a file is created or modified (properties only)" ?

Where it should put?image.png

 

Thanks


 


 

chrismanncg
Level: Powered On

Re: Duplicate approval for Sharepoint files when modified

Hope the screenshot helps. I've not got time to go any more into this sorry, very busy.

 

Capture.PNG

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 71 members 4,434 guests
Please welcome our newest community members: