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

Email trigger flow stuck in infinite loop?

I'm having a weird issue that I haven't quite seen described here...

 

I have a Flow that triggers on "When an item is created or modified"

The flow then updates a field on the same item.

When I first create this flow, It worked great.  I could create an item or modify it, the flow would trigger, change the item and all was good.

Now we are finding that if we create or edit an item, the flow runs every minute for days.

I can stop the flow, start it again and all is good until we create/edit a new item.

It looks as though the flow doesn't recognize that it was the process that last modified the item so it just keeps going.

This is what it looks like:Flow-BranchModify.pngAny ideas?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Email trigger flow stuck in infinite loop?

Hi @sperley,

 

The flow with trigger "When an item is created or modified" would always be triggered when the item is created or updated from the sharepoint list or by flow.

 

As the alternative solution in the lionk below:

https://powerusers.microsoft.com/t5/General-Flow-Discussion/run-flow-when-item-modified-not-from-the...

 

If you would like to run a flow only when an item is modified from the sharepoint list, and don't want to run a flow when an item is modified from the flow, as an alternative way,you could consider:

1.add a "Yes/No" type column "ModifiedByFlow" in the sharepoint list, and set the defaults value of "ModifiedByFlow" column to No.

2.when modify an item from the sharepoint,keep the "ModifiedByFlow" column to No.

3.every time modify the item from flow use the Update item action, set the "ModifiedByFlow" column to Yes.

4.add a condition under the trigger "When an item is created or modified" to check if the item is modified from sharepoint or from flow, if the item is modified from flow, do nothing.if the item is modified from sharepoint, do something you want .

 

Best regards,

Alice

View solution in original post

5 REPLIES 5
Community Support Team
Community Support Team

Re: Email trigger flow stuck in infinite loop?

Hi @sperley,

 

The flow with trigger "When an item is created or modified" would always be triggered when the item is created or updated from the sharepoint list or by flow.

 

As the alternative solution in the lionk below:

https://powerusers.microsoft.com/t5/General-Flow-Discussion/run-flow-when-item-modified-not-from-the...

 

If you would like to run a flow only when an item is modified from the sharepoint list, and don't want to run a flow when an item is modified from the flow, as an alternative way,you could consider:

1.add a "Yes/No" type column "ModifiedByFlow" in the sharepoint list, and set the defaults value of "ModifiedByFlow" column to No.

2.when modify an item from the sharepoint,keep the "ModifiedByFlow" column to No.

3.every time modify the item from flow use the Update item action, set the "ModifiedByFlow" column to Yes.

4.add a condition under the trigger "When an item is created or modified" to check if the item is modified from sharepoint or from flow, if the item is modified from flow, do nothing.if the item is modified from sharepoint, do something you want .

 

Best regards,

Alice

View solution in original post

sperley
Level: Powered On

Re: Email trigger flow stuck in infinite loop?

Thanks Alice (@v-yuazh-msft),

 

That does workaround the issue for me and I was able to add it to my list and Flow fairly easily.

 

Being used to SharePoint and Salesforce workflows, I've never had to build that qualification in...  Is this something that is being looked at for future releases?  

johnguilbert190
Level: Powered On

Re: Email trigger flow stuck in infinite loop?

Just a note that this will not work. The only way you can update the "Modified by MS Flow" field back to "No" is by doing an update which defeats the purpose. 

I would recommend using a single previous field called "Previous Fields" which is a concatenation of fields you want to change. Then compare this in your condition with the current values. Then update the "Previous Fields" field with the new concatenated values.

Mike2500
Level 8

Re: Email trigger flow stuck in infinite loop?

It depends on how that field is being updated. If it's a form customized with powerapps or infopath, the form could flip that field, which would result in the workflow running correctly. But yes, you're right that this is complicated, more than it should be.

akh0123456789
Level: Powered On

Re: Email trigger flow stuck in infinite loop?

@v-yuazh-msft 

Alice,

 

I'm attempting to do as you suggested but am having trouble with Step 4: 

4.add a condition under the trigger "When an item is created or modified" to check if the item is modified from sharepoint or from flow, if the item is modified from flow, do nothing.if the item is modified from sharepoint, do something you want .

 

What does this look like?  Would you attach an image with an example?

 

Also, does the SP column need to be added to all content types or just to the specific library I want to check it?  Currently I created it just in the library I am checking for the trigger: When a file is created in a folder. 

 

Thanks

 

Andee

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (6,201)