Skip to main content

Notifications

Power Automate - General Discussion
Answered

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

(0) ShareShare
ReportReport
Posted on by 203

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? 

  • RezaDorrani Profile Picture
    RezaDorrani 12,141 on at
    Re: Circular reference Issue - Need to Stop a Flow from Re-Running - D365

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

     

  • saturation Profile Picture
    saturation 203 on at
    Re: Circular reference Issue - Need to Stop a Flow from Re-Running - D365

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

  • RezaDorrani Profile Picture
    RezaDorrani 12,141 on at
    Re: Circular reference Issue - Need to Stop a Flow from Re-Running - D365

    Hi @saturation 

     

    try

     

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

  • saturation Profile Picture
    saturation 203 on at
    Re: Circular reference Issue - Need to Stop a Flow from Re-Running - D365

    @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.'."}}'.

  • Verified answer
    saturation Profile Picture
    saturation 203 on at
    Re: Circular reference Issue - Need to Stop a Flow from Re-Running - D365

    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?

  • Verified answer
    RezaDorrani Profile Picture
    RezaDorrani 12,141 on at
    Re: Circular reference Issue - Need to Stop a Flow from Re-Running - D365

    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

  • saturation Profile Picture
    saturation 203 on at
    Re: Circular reference Issue - Need to Stop a Flow from Re-Running - D365

    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?

  • RezaDorrani Profile Picture
    RezaDorrani 12,141 on at
    Re: Circular reference Issue - Need to Stop a Flow from Re-Running - D365

    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

  • saturation Profile Picture
    saturation 203 on at
    Re: Circular reference Issue - Need to Stop a Flow from Re-Running - D365

    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?

  • RezaDorrani Profile Picture
    RezaDorrani 12,141 on at
    Re: Circular reference Issue - Need to Stop a Flow from Re-Running - D365

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard