cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
saturation
Resolver I
Resolver I

Circular reference Issue - Need to Stop a Flow from Re-Running - D365

I'm having an issue where I'm using a Flow to update a record in D365 that was just updated by some manual user input in D365 (rather than using traditional D365 workflows). The problem is that since the update is happening on the same record on the same table, it's seemingly firing the Flow again into an infinite loop. Is there any way to prevent this? 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @saturation 

 

You would have to maintain some flag in order to do this

When flow updates it - set flag to 1

when manually done - set flag to 0

 

and then u can trigger conditionally nly if flag value is 1

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

Sounds like I would need a hidden field on the form so when it's saved, it sets that value to 1. Then, when it runs in Flow, set the trigger only where it's 1, and then at the end of the Flow, set it back to 0?

View solution in original post

10 REPLIES 10
RezaDorrani
Dual Super User
Dual Super User

Hi @saturation 

 

In Flows now you can do conditional triggering

https://www.youtube.com/watch?v=j-gP-E6CCE4

 

You would have to setup the expression based on your scenario

may be set a column value or check the last modified date

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Interesting. Watched the video. I guess I'm looking for ever further guidance. I would like to see if a field I created called new_testfield has changed. The question is, there's no guidance on the syntax for a trigger like this. How would I check to see if a field called "new_testfield" has changed using the Trigger Condition?

Hi @saturation 

 

@not(equals(triggerbody()?['fieldinternalname']),null)

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Thanks, after thinking that through, I guess that won't fully detect whether the update was done by a user clicking Save in D365 or whether the update was done from a Flow. Is there any way to detect which did the update so that if it's done by Flow, it doesn't keep looping through the Flow?

Hi @saturation 

 

You would have to maintain some flag in order to do this

When flow updates it - set flag to 1

when manually done - set flag to 0

 

and then u can trigger conditionally nly if flag value is 1

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Sounds like I would need a hidden field on the form so when it's saved, it sets that value to 1. Then, when it runs in Flow, set the trigger only where it's 1, and then at the end of the Flow, set it back to 0?

@RezaDorrani 

 

@not(equals(triggerbody()?['msflowtrigger']),0)

I also tried 

@not(equals(triggerbody()?['msflowtrigger']),'0')

 

Request to Azure Resource Manager failed with error: '{"error":{"code":"InvalidTemplate","message":"The template language expression evaluation failed: 'The template language function 'equals' expects two parameters: the values to test for deep equality. The function was invoked with '1' parameter(s). Please see https://aka.ms/logicexpressions#equals for usage details.'."}}'.

Hi @saturation 

 

try

 

@equals(triggerbody()?['msflowtrigger'],'0')   assuming msflowtrigger is a text field

🙂 Well that explains it--my field is an integer...What's the syntax then testing an integer?

 

@RezaDorrani 

 

And by the way your help is very much appreciated.

@saturation 

 

fastest way out - make it a text field since it is hidden anyways

 

for whole number

try @equals(triggerbody()?['msflowtrigger'],0)

 

or @equals(triggerbody()?['msflowtrigger'],int(0))  

 

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (2,003)