Avoid infinite loops with flow trigger conditions in Power Automate
ฝัง
- เผยแพร่เมื่อ 16 ธ.ค. 2024
- In this video on Avoid infinite loops with flow trigger conditions in Power Automate we will cover the following:
1. Preventing infinite loop/race condition - Same item is modified within the flow.
2. Trigger flow when a column value is updated.
Conditionally trigger your flows.
Save flow runs and api calls by only triggering your flows as and when required based on a condition.
There are daily api call limits per licensed user account for a 24 hour period.
docs.microsoft...
Saving api calls is key to utilizing flow effectively and ensuring you build flows that are called only when required.
#Buildingflows #Optimizeflows #Saveapicalls #triggerconditions
Really helpfull video, i just had this scenario yesterday 😋
Hope it was useful :)
Really really helpful video! Subscribed already. One if the rare video which does not have any dislike.
Kudos! You are doing an amazing job!
Thanks a ton.
To be honest, I never get offended by dislikes. Everyone is entitled to their own opinion.
Thank you so much for this video! You saved me a lot of pain as I was not understanding why it would re-trigger. SharePoint Designer didn't need this extra programming.
Glad it helped!
@@RezaDorrani How would I edit the formula you have in this video to not run the flow if the last modified value was equal to the service account AND when a certain SharePoint column is NOT blank?
thanks Reza! you saved the day again with a method that works.
Most welcome!
Thank you very much Rezza I have been trying to configure out this solution long time, I wanted to check completion date of project and then need to update valuation date for project after 7 days of completion of project. I could use the calculated column using formula = [completion date]+7, but I didn't want to change the list settings but I wanted to resolve it with power automate workflow only . And this helped me to eliminate infinite trigger loop.
Glad it helped
Hey legend, only genius like you make up this idea...
Thank you for your kind words
Thank you really much. I’m really sure that most of the companies are not aware of the api requests limitations. Especially with the retirement of the SharePoint 2010 workflows, many users will run into problems. So hopefully Microsoft Lists and it rules can help here also a little bit.
Agreed with the new rules part. But those are for simple scenarios. Flow will always be the answer to more complex scenarios.
Dear Reza, this is a great video and your instructions are clear and useful!
I have a question: your second scenario is implemented in a SharePoint list.
I have tried to apply it to a SharePoint document library (where my business users drop invoices and I would like to notify them only when Assignee column is changed) but I am not able to leverage the customized form I have created according to your tutorial.
In the SPO Document library according to my knowledge there is no direct access to customized form: double click will open the file preview in full screen (PDFs in my case), and to edit file properties I have to enter Grid view or click on the small "i" of information on selected item.
These actions are not triggering customized form and the runtheflow column is not changing.
Any suggestion/workaround to deal with same scenario but with doc libraries?
Thanks for your attention 🙏
Not sure about doc library as I may not have tried it. I will recommend posting your issue with screenshots on the forums at powerusers.microsoft.com
Thank you for sharing Reza, it rocks !
My pleasure!
Thank you so much Reza for this demo!
I have a question: your second scenario works for Sharepoint Batch API update?
I have not tried with SP Batch API so not sure. Give it a try and test.
Top scenario! I only had to figure out this works for Choice-type column (in your video Category column). But I am very happy with the result. Thanks!
Glad it was useful. Thanks for watching Loek.
Reza, if you could please help it would be greatly appreciated, I have a flow where the trigger is when file is created or modified. When a document is added it is in a checked out state while meta data is assigned, once that meta data is assigned it checks the document in and goes through the approval process, however, if an approver modifies the document, it runs the flow again, is there a trigger condition that will prevent the flow from being run again despite edits/changes being done to the document, my only current trigger condition is below (column choice)
@equals(triggerBody()?['Type_x0020_of_x0020_Request']?['Value'], 'Change')
You would have to set some kind of flag to avoid re-triggering of the flow like the one shown as part of this video.
Once the flow runs, set a hidden column (flag) value and add that to the trigger condition.
This is just what i have been looking for 😊👍
Most welcome
Thank you Sir this helps a lot as always. In my case, I also had a parallel action of scopes that were running. Now I reconfigured the scopes to run one by one by adding your first tip here;. i.e. I restricted my account. But I am wondering if the parrel scopes were among the reasons for my flow to be throttled. the scopes were independent actions to make and I redesigned them to run step by step if this adds value to not being throttled again. Again thank you so much for making an impact on many professionals across the globe.
Throttling can occur due to various reasons. Depends upon number of actions running, loops etc.
Reza, sorry to ask what might sound like a silly question but if I put a condition on 'when item is created' for a sharepoint list to only take action if an item is null would it still count as an API run when this condition is false i.e when there is data in the column so it would never get to the action stage. I think I'd be ok with the 2000 limit anyway, probably be around 800 per day but just wanted to double check. Thanks for your videos you're a credit to the industry.
I believe they would not be counted. Actions start getting counted once flow runs.
Hi Raza, thank you as always. Its very helpful. One question though, if you have a SharePoint list which gets updated from excel with schedule and I don't wanted the email to be send out in this scenario. do you have any recommendation? thanks again
I would have to try it out to provide guidance. I recommend checking on the forums at powerusers.microsoft.com/ in case someone has done something similar.
This was incredibly helpful !! Thank you so much !!
You're so welcome!
Thanks for this tutorial. This is really helpful and useful. Just to ask if how can I achieve if specific field has no value and workflow will not trigger?
Hi Jaina,
You can use expressions to check if field is empty and accordingly define your trigger condition.
To learn about flow expressions - aka.ms/learnexpressions
When we create a workflow using service account, After that we need to test it with the service account before with some actual production account, Then in that case, Solution 1 will not work as the service account will not be able to test the workflows by itself.
Correct me, if I am wrong?
Thank you,
Abbas.
Data can be created by user accounts (could also be test accounts). The workflow service account is the one running the flow.
Hi Reza, love your work boss . I have a flow that I require it only run when the status of the column is "submitted" . And then an approval will be sent to the managing director. However I am constantly running into an infinite loop and I have seen to run out of ideas . Please could you assist
I have not come across the issue you mentioned hence not sure the reason why it is happening in your case. I recommend posting your issue with screenshots on the forums at powerusers.microsoft.com
Really nice video its helpful for me to resolve infinite loop.
Thank you Nilesh. Glad it was helpful.
@@RezaDorrani please let me know more information regarding flow and power apps so I will improve my skills. Is it any development article or course please suggest.
Thank you.
Nilesh Birari check aka.ms/powerplatformresources
Hello Reza, Appreciate your crystal clear demos.
Have a query wrt second part of your demo "How to trigger flow when value of columns changes".
Scenario:
> We have "Feed back" list with choice column: "actionStatus"
> It has default values "Open", "Closed"
> IMP note: It has default value "Open". Objective is to trigger mail, when feedback item is created, with default value "Open".
> Second part in the demo addresses only if existing value changes i,e here if "Open" to "Closed"
But we need flow to trigger first time then wait if value changes.
Any suggestion is welcome.
Why do you want flow to trigger first time and wait?
Why not trigger flow on item created and modified both.
Flow trigger cannot track changes.
@@RezaDorrani Well regret if im unable to put the constraint here.
1. Flow to send mails only for changes in column "Status" only. No other column updates should trigger mails.
Used "Has changed.." action to meet this req. But this will not trigger mail for default "open" status as it expects it to change to "closed"
Now only way to address this is to use 2 different flows "When item created" and "When item updated"
@@veerpat5331 That would probably be the way I guess
Hi Sir,
I want GUID of last submitted record of power app but it not working. I'm using function "Set(varGUID, Form1.LastSubmit.) but this is not working
I will need to look at your app in action to know the reason why it’s not working for you. I would recommend posting your issue with screenshots on the forums at powerusers.microsoft.com
Awesome Video... but for some odd reason, im still getting the infinite error. I added a column called "Audit Date" which is a date field based on a column called Audit Status (Pass or Fail). Once the user updates the Audit Status, i want the Audit Date to update to today's date. Followed this and as soon as i setup the Update Item piece in PA, i get the Infinite error again. Maybe my trigger on the new or modified item piece is not right - equals(triggerBody()?['runtheflow'],'yes')?? Im trying to also figure how to set that date field, but before that, im still getting the infinite error first.......
When you are updating the item, you should set the runtheworkflow column value to No.
@@RezaDorrani hi again..... in the Update item piece of the Flow, is it as simple as putting "No" for the runtheflow column? Because i tried that and the error is still there. I sent you an email to your outlook email.
@@chrisnorris1556 Ensure you have the trigger condition in place.
Thank you, Reza. I am working on a similar scenario except my equivalent of your Category field is people picker (multiple allowed) field. Is this still workable? I am having problems with the If condition on the default of the RunTheFlow datacard.
Welcome!
Should work with that column type as well. Code would not be the same.
I don’t have a specific video reference on it though.
I recommend checking or posting your query on forums in case someone has done something similar powerusers.microsoft.com
@@RezaDorrani i will, thank you :)
Hi Reza! Yet again, another super helpful video!! Can i ask you something?? We dont have service accounts, so I was doing the second solution, but it is not working for me. Does that solution work when it has to read a calculated column??? That column reads changes in date with an IF formula (on time, due and expired)
Calculated columns do not work well with flows. You would need to build your calculation logic in the flow itself.
A service account is just a regular user account.
@@RezaDorrani thank you!! Will try to do that
@@RezaDorrani hi again! Tried again with a Date field (normal date field) but when I change the date, it doesnt show me the "yes" result, stays as "no" for the datacard, it only accepts ".Default", otherwise, brings back error. For dates it works differently??
@@Fernanda-uh7iz I am confused. Video is on flow. Where did datacards come in flow?
@@Fernanda-uh7iz Its tough to provide guidance here in chat without looking at code and app. I will recommend you post your query with screenshots on the forums at powerusers.microsoft.com/
good explained. Short question: If the column is not visible in the card but still the flow should be triggered when this column changes. How can i set up the condition?
As long as the column is part of the data card, even if it is not visible it will trigger the flow.
Awesome Tuts Reza. Thank you. You have helped me a lot. I made a Flow using "When a file is created or modified in a folder" to post to Teams when a News item is created and/or updated. It gets triggered every time an item is updated. I would like to limit the trigger but I can't seem to find a way. I've tried this formula "'The template language function 'subtractFromTime' expects its first parameter to be a string that contains the time. The provided value is of type 'Null'".
Ho can I make that the flow don't pick up changes within the first hour? Could you give me a hand on this? Thank you in advance.
There is an issue with your expression. Not sure what you mean by first hour.
I will recommend you post your query with screenshots to the community forum - powerusers.microsoft.com/t5/General-Power-Automate/bd-p/MPAForum
Thanks. Interesting approach. Does this still work if you have three important fields that need to be monitored as such. Would you create the one flow and copy them for the other fields? I was using a condition and get changes so that if any one of those three has changed, run the flow. BUT, then it went into the loop scenario again.
It would be nice if msft implemented the 'Terminate Control' function to actually terminate, not just provide a status then keep running. That doesn't help anyone.
I did not understand your scenario. Idea is to change that flag so flow does not retrigger.
ideas.powerautomate.com/d365community/forum/086dd68e-597f-ec11-8d21-0022482e8f9f is the best place to post for ideas (Example: Terminate Function)
@@RezaDorrani Yes, understood, in my case I have three fields that may be changed and monitored AND they're all drop downs.
I'll try your method on one and will try another using conditions to see if the field value is equal to fieldtxt.
Sidenote: I had to create a bunch of text fields based on their values since MSFT didn't see fit to provide the functionality of creating lookups on those fields.
@@carlw Give that a try.
Best place to give Microsoft feedback is the ideas board.
@@RezaDorrani Tx. LOL don't worry, I have many many times, to no satisfaction. However, in fact my idea did work 👍🏻until, "miraculously" it decided to hang.
Seems a little html table was just far to complex for it.
I don't mean to sound negative and cynical but in reality, would you want their.......software to be used on jet fighter aircraft?? Ya, probably not.
Overdone bloatware always completed to maybe 75% of required scope.
@@carlw Ideas that are highly voted for are worked upon. I am not in favor or against anyone, but I have seen ideas becoming a reality.
Forums is another great place to post issues/queries. I am someone who has gained a lot from the forums, from asking for help to helping others, forums have helped shape my career and the community team behind it works really hard.
Hi Reza, I have a yes and no toggle box, how to make the choice status change to In Progress when yes is selected in the powerapps form?
I do not have a video reference on this scenario and would have to try it out to provide guidance. I would recommend posting your issue/query with screenshots on the forums at powerusers.microsoft.com
This is really helpful stuff, thank you so much!
Thank you for watching
Can you use a trigger expression within the trigger for when a certain SP List item is updated with certain selection or a word? My switch and control conditions do not work if inserted into the flow after the trigger.
Yes can be done in either the trigger condition itself or after the flow gets triggered.
What does certain selection or a word mean? I am assuming whether a column contains a value. You can use expressions to do so.
Thanks a lot for this great tip!. Just a question, so it means that if I have 9 actions and 1 trigger in my flow, that will use up 10 API calls out of the 2K whenever it runs?
Yes - based upon docs.microsoft.com/en-us/power-platform/admin/api-request-limits-allocations
How would the formula need to be adapted if I wanted to only trigger on a particular choice or two being the updated value in the trigger column. E.g. if your Category column had IT, Security, Hardware and Platforms and you wanted the flow to run if the value in the Category column was updated to either Hardware or Security - how would that formula read? (I tried replacing with = and adding the specific value in quotes but it didn't work)
My use case is a status column where when Completed or Declined is selected I want the date autofilled in the Completed Date column.
Something like
@or(condition1, condition2)
Good day. Thanks for the video. I have followed the steps but it is still not working. Only works in the test workflow function. Please advise what I could be doing wrong?
Steps applied:
1.Changed all the connections to the service account
2. Made sure the account had access to the sharepoint list
3. Applied the script provided but changed to my service account address.
4. Logged in as my user and made an update. In the version history I can see I have made the update but the workflow does not kick off.
5. Clicked on test work and it works. When I go back to version history I see the service account made the update.
6. When I remove the script then the workflow works from the sharepoint update but then goes into the loop.
I cannot guess the issue here on chat. Best to post your issue with screenshots on the forums at powerusers.microsoft.com
@@RezaDorrani, thank you for the response. I managed to get it working. What I noticed from a test run was that email was returning Nil but the modify claims indicated the service account so from the logs I copied the modify claims output and added that to my trigger
Hey @Reza great video. is this scenario work for attachments ? means first time we added 2 attachments,and later if we delete one attachment in edit mode, can we keep track on that?
Thanks in advance...
To keep track of how many attachments got updated you would need to check the version history of the list item and compare the attachment count.
This cannot be done in the flow trigger.
You would have to implement this within the flow action.
Why is this SO much more complicated than using the Workflows in SPD ? as a non programmer Power Automate has been a constant struggle and is extrordinarily disappointing. A 5 min workflow has now been replaced with power automate, power apps and adding triggers and coding to ensure that a workflow doesnt repeat. MS have dropped the ball incredibly on this. Thanks for your help.
Hi Mark, I understand the challenges in flow when comparing with SPD. Its important to know that flow is designed to work with any data source. SPD is SharePoint only. They are 2 completely different services. It will be a learning curve and hopefully my channel has some decent content to simplify the learning experience.
@@RezaDorrani thank you Rena for your reply. I will continue. Good work sir
Hi Raza, thank you for this amazing method. I implemented it and it worked perfectly. But only for a few weeks. After some time i noticed that the flows don´t get triggered and checked the "runtheflow" cards. The condition in the Default wasn´t there. This happend twice now and I made sure no one else changed it. For me it looks like it got set back to the general function. Do you know of such a problem or how I can fix it? Thanks!
I have not experienced the mentioned issue and hence not sure what the cause for it could be.
I will recommend posting your issue on forums in case someone has experienced something similar powerusers.microsoft.com
I am attempting to find a way to avoid a loop but every scenario I find doesn't apply to my situation. I have watched your other videos as well. I have a choice field. And I need to only run the flow one time but it keeps looping. I attempted an update item right after they user makes the selection and hits submit. I am not sure how to limit it so that it only runs one time - I need the choice field to be updated but it keeps looping. It can't just be a user (like this example). I am feeling pretty frustrated as every example I try - it loops.
Technique is to use trigger conditions and set that flag. It does not matter which type column you use.
As for your issue, I will have to look at your flow in action to provide guidance. I would recommend posting your issue/query with screenshots on the forums at powerusers.microsoft.com
This is a great video. Thank you so much for sharing. I'm going to use this for sure. I have a scenario I'm stuck at, not sure if you can point me in the right direction. If I have an end date and if that end date has arrived, I'd like to use that as a trigger to send an email to the original creator of that entry. I can't seem to get the condition statement to work. It fails each time. Is there some kind of limitation with these conditions related to dates? I saw something about tick function but I don't fully understand. Do you have any pointers? Thanks so much in advance.
Your case will not work with a trigger condition.
You can use a scheduled flow that runs on a daily basis. In that flow query your data source to get all items where the end date has arrived. Todays date >= end date.
For each of those items, send an email.
Give the abive a try and if you need more help then try posting your question on the community forum.
powerusers.microsoft.com/t5/General-Power-Automate/bd-p/MPAForum
@@RezaDorrani thank you for the direction
Hi Reza,
I am using a flow to submit a customer query and flow triggers when the field assign to is updated the the Assignee. Since i have a JSON code assigned to the SharePoint List Input form i cannot use power-apps. Is their any way i can get this run only once when the Assigned field is updated. Please advise if i can put any condition to do the same.
Thanks
You can trigger flow when assigned field is updated. On item updated trigger.
Not sure I understood your question clearly though.
Dear Reza Dorrani,
your tutorials are extremely helpful, thank you for that.
Could you please, please do a tutorial like this with an automated flow to create & update Outlook Calendar Events from corresponding columns (when a column field changes, i.e. start/end day AND OR status column to be included in the event subject, i.e. pending or confirmed) in Sharepoint Lists?
This should be simple, but I did a lot of research and am quite confused. I had a flow that worked fine, but indeed had to turn it off to avoid infinite loop.
I`ve seen various approaches on different platforms meanwhile i.e. add Trigger condition/s, update item with event ID, get events first and compare to exiting items, but I am uncertain as to how these could be combined (or not) in one flow and also what expressions to use exactly.
It seems to be a topic that is frequently requested on various platforms, so I am certain this would help many users. Thank you ever so much!
Thanks for watching.
Help me understand your request. So a list in SharePoint, when a column value changes (start day or end day), then create or update outlook calendar events. So basically, drive calendar events from a SharePoint list?
@@RezaDorrani Hi, thank you for checking - yes, sort of - I know how to create calendar entries from a "when a new item is created" (in SP List, that one is fairly simple, same goes for deleting, when an item is deleted, it could of course also work with a recurrent flow).
Unfortunately, creating (and conclusively, updating the corresponding calendar event) when -and ONLY then- the specific field in a column in an already existing item (record/row) in an SP List (field can be empty up to then) is entered/updated (with the "when an item is created or modified" trigger), but limiting the trigger condition, (when the value in the column gets added or changed) - is the tricky part.
I found various approaches to this, but nothing really worked so far. Ideally combine with "send a notification about added event/changed event (not an invite, just the info, could also be a "post to channel")" action. By studying and watching a lot over the last weeks, I think I am close to a solution, but not very confident.
@@kayfax672 I will add this to my backlog
@@RezaDorrani I can imagine this is quite long;-) btw - if you were to consider running a patreon account to share certain info with subscribers /paying patrons there - I'd subscribe/pay immediately!
@@kayfax672 I have been thinking about Patreon and/or TH-cam subscription based content and/or some live classes on weekends. May be I run a poll on in the community tab and see how much interest is there. What say?
Hello Reza,
My sharepoint is a document library, not a sharepoint list. So users can modify the metadata also in the documents (excel files > file > info...) themselves. What happens if a users would do that? Will your solution still work? How do I solve this?
It would not work in that case. You would want your users to modify the metadata via a defined process inorder to ensure that flag is set everytime.
This conditional trigger does not seem to work when the Content Approval is activated on the list. The trigger works when it's not activated on a list that does not have this activated perfectly. The concept of how the workflow updates an item here remains the same but I can't get it to trigger at all. I've been searching but nothing comes up around this scenario. Any assistance/suggestions are welcome and appreciated. Thanks.
May be it has to do with the security. The flow Owner must have Full Control access on SP list in order to get data for all items.
@@RezaDorrani that actually worked, thanks! But then because it's a content approval document library it sets back the approval status to 'Draft' and the user has to submit for approval again. It's still causing a loop.
@@Firebus1122 You will need to handle infinite loop. I have a video on that.
Is there any way to get rid of looping of compose? If it get looped I can't use the compose action in create file as I am generating pdf. Thanks.
This was done a long while ago so do not remember.
I will recommend checking on the forums at powerusers.microsoft.com/ in case someone has done something similar.
HI Reza, this video is exactly what I am looking for, but when I put in my expression If(SharePointForm1.DisplayMode = DisplayMode.Edit && DataCardValue14.Selected.Value ThisItem.CurrentLocation.Value ,"yes","no") I get an error saying the values being compared are not the same type. I have tried using different names for the same fields, without success. I also keep getting a message that my formula uses Scope, which I don't understand. Any recommendations would be appreciated--I am desperate at this point.
Update: The expression will work if I substitute the ThisItem.CurrentLocation.Value with another selected value from a different column like this: If(SharePointForm1.DisplayMode=DisplayMode.Edit && DataCardValue14.Selected.Value DataCardValue8.Selected.Value ,"yes","no").
But my goal it to track when a specific status changes, as you discuss in the video, so the expression needs to compare the two states (before and after change) of the same column.
I have not experienced the mentioned issue and hence not sure what the cause for it could be.
I will recommend posting your issue on forums in case someone has experienced something similar powerusers.microsoft.com
@@RezaDorrani While I am sad there isn't an obvious fix, appreciate you actually responding. I have never used the forums before, but I will try. Thank you for making such helpful content.
Update: For any of those interested, the forum help I got suggested this expression: If(SharePointForm1.DisplayMode = DisplayMode.Edit && DataCardValue14.Selected.Value in ThisItem.'Current Location'.Value ,"no","yes"). The key difference being "in" vs . I am not positive why this is better for me, but it seems to be working so far--Thank goodness!
Hey @Reza great video. We are using Automate to create a record into a new List based a change to a field in an existing List. Quick question when testing this solution with my PowerApp the Power Automate generates two identical items when run. Not sure why its doing this? Is this something you have encountered in the past? Any help with this would be gratefully accepted.
Thanks,
Pras
Did not encounter a scenario like this.
Check to see if your flow is running multiple times or are there other flows that are getting called?
@@RezaDorrani , hey you were right. There was another flow running which has now been switched and this new one runs exactly as I need it to. Thank you
Hi Rezza-I tried to run the formula If(SharePointForm1.DisplayMode=DisplayMode.Edit,"Yes","No") to PApps and its not working my field.
I would have to look at your App in action to know the exact cause of the issue.
I would recommend to post your issue with screenshots on the forums at powerusers.microsoft.com
my Cloudflow has the warning saying that it may result in a loop. It filters when changing a field that cannot be null, at the end of the CF an update is made so that the field becomes null. Then the CF will not fire again in the loop. How do I make this warning no longer appear, that is, the checker no longer considers it a warning?
The warning will always be there. As long as you are handling it in flow, you should be good.
Hi Reza, this is very useful, I am running into problem of infinity loop using SP list to send out approval workflow, will it be the same method?? Can you also show a video on that? it's not stopping.. thanks.
Method would be same. Check my flow approval video series - th-cam.com/play/PLTyFh-qDKAiFUGTtwSwFT79Y7_jq_Aipe.html
Nice Video @Reza. On similar path I am facing one challenge.
1. I have one PowerApp from which I am triggering flow on add/update item in SharePoint list.
2. Then approval starts on new/updated item using flow. However, before "Update Content Approval" flow I am using "Update Item" because of some business logic. Which then starts the trigger.
I want to block that trigger for 3rd time, because I am not updating the content status before that.
Current Flow triggers on,
1. Item add/update
2. Trigger is running more than once after using "Update Item"
Query,
1. Is it necessary to have update content approval status in lists?
2. In above situation how to block if power app and flow are using same service account.
Thanks in advance :)
If Power Apps is calling flow, then flow will run under context of user running the App.
Power Apps can never use a service account. Because App always runs in context of logged in user.
@@RezaDorrani thank you. This means I can use your first scenario. Thank you 😊
Hi Reza, if your trigger is from an email received and you filter the subject will it still call APIs even the email you receive is different subject? Should I still put a trigger condition containing the words in its subject only?
The subject itself is the trigger condition for that action. Not sure what you mean by call APIs?
@@RezaDorrani Ah because you said in the video it will keep on running(race condition?). So if I put the subject like contain expression in the "When a new email arrives in a shared mailbox (V2)" that's ok already? Or should I go to setting and paste the trigger condition like what you did here.
@@aqpogi Race condition I said was for SharePoint list where trigger is also based on it. That cannot be true for emails.
@@RezaDorrani Thanks for quick response!
Hi Reza. Can you help me with a problem I am facing. I have a flow that triggers when an email arrives in a shared mailbox (in a specific folder). So whenever someone moves any mail from inbox ro that folder the flow triggers. My problem is that this flow is running sporadically. It is missing mails and I have to click on edit and re run the flow. Often it runs for some mails and misses some in between.
Why is this happening. What can I do so that it runs smoothly without missing any mail. Please help.
For that I would have to look at your flow in action and debug it step by step.
I would recommend you post your issue/query with screenshots on the forums at powerusers.microsoft.com
In your second example (run flow only when a specific column changes), won't you be back to the infinite loop issue of updating the list item that had triggered the list flow because of an update to it? (since you removed the trigger condition that compared the person running the flow to the service account)
Hi Betty,
It won't run into infinite loop condition because I do add another trigger condition in there to handle it. I check to see if the runworkflow field is set to true
Timestamp 14:27 was the solution for my scenario with mutiple flows, running if "item is modified" - thank you SO MUCH! 🎉@@RezaDorrani
Still works like a charm.
Thanks
@@RezaDorrani It's me who should be thankful, I've borrowed your knowledge more than a handful of times. Thanks you, Reza :)
Hello!! Any idea on how I can send all files uploaded to drive by the same user in the past few minutes in one email? Considered using a trigger condition like the one shared and a delay action.. but not sure if that works. Hope to be able to get some inputs 🙏🏻
I have not tried that scenario. I don't think it would be a trigger condition. It would be more like a scheduled job that runs on a schedule and checks files in drives and then sends email. I would recommend you post your issue/query with screenshots on the forums at powerusers.microsoft.com
Hi Reza,
Can you please suggest what can I do? My expression doesn't have "triggeredBoday". Below is my error message:
Request to Azure Resource Manager failed with error: '{"error":{"code":"InvalidTemplate","message":"The template language expression evaluation failed: 'The template function 'triggeredBody' is not defined or not valid.'."}}'.
I will have to look at your flow in action to provide guidance. I would recommend posting your issue/query with screenshots on the forums at powerusers.microsoft.com
@@RezaDorrani Hi Reza, thanks for reply. I have gave up this solution but changed my flow structure to stop infinite loop.
My solution is to create "switch-Restart Flow" Yes or No, and then in the Yes branch, create "switch-Status" Pending First Approval, Pending Second Approval.
All no branches have been set to terminate.
Hi Reza, i created coloumn in sp and pulled and configured in powerapps, now in Pautomate I'm stuck. Coz there are multiple steps before aproval ( include variables, get file properties and approval and conditions after update item for sp. I added the trigger expression but still flow checker showed infinite loop warnings. Pleasee suggest
I would have to look at your scenario / flow in action to provide any guidance. I would recommend you post your issue/query with screenshots on the forums at powerusers.microsoft.com
This is awesome!
Thank you
Hi Reza, thank you for the information provided. I have a different condition which i'm trying to avoid using power apps. I have a SP list with rates and the item created or modified is assigned to a project manager so only the project manager and the owners of the SP group can view or edit the item. To change the permission i went ahead and created a flow that any time an item is created or modified in this list, the permission changes to the project manager email (column is setup by column). The problem is that i want this flow to run only when the project manager value is changed or created. How do i do that without using power apps? because power apps changes the form layout. Thank you in advance
@not(equals(triggerOutputs()?['body/AssignmentLeader/Email'], current or previous email]))
You cannot write trigger conditions on preview value since trigger action will not have that info.
You would need to set a flag (as shown in video to avoid infinite loop trick) when manager is changed in list.
You cannot write trigger conditions on preview value since trigger action will not have that info.
You would need to set a flag (as shown in video to avoid infinite loop trick) when manager is changed in list.
@@RezaDorrani Thank you for the response. Is there a way to setup a flag without using PowerApps?
@@davidregis2693 Goal is to set a flag (column) when a specific column is changed. Power Apps or SPFx would be the 2 options I can think of.
Could you please guide me on how to terminate one flow from another without using premium connectors? I have the Approval Task ID available.
Not something I have tried or explored.
@@RezaDorrani could you please include flow termination in upcoming videos
@@Amar-uy4gl I make videos when I receive multiple requests on a topic. Every 6 months I ask subscribers for topic suggestions on Community Tab of my channel. Most voted idea gets added to my backlog. Make sure to post this idea whenever I post the next topic suggestion post.
Hi Reza,
How can i stop multiple email notifications whenever the same file is modified in sharepoint?
Not sure what your exact use case is.
You can trigger flow when item/file is created or use some form of flag logic as shown in video.
Reza is this still valid case, where the flow could run to race conditions? I tried the same and I did not put any conditional trigger it did run into infinite loops..
it did run or it did not run into infinite loop?
@@RezaDorrani it did not run. Do you think I am missing something?
@@vinayayinapurapu What is your trigger action? And are you updating the same item on which the flow is being triggered?
Hi Reza you catch nice point on Api call..so if I am using Flow connector in Powerapp to retrieve data from other system does it consume API calls ? So if create Custom connector instead of Flow connector does it saves me ? From api calls
Api calls are counted against both power apps and flow for a 24 hr period. So the answer is yes - it does consume calls.
Custom connector does require a premium license and calling the connector is also an api call
hello Reza, I'm getting this error " Cannot read properties of undefined (reading 'properties')" do you have any idea what's the solution?
Note: the trigger is not SharePoint it is
Recurrence.
I have no idea. I will recommend posting your issue with screenshots on the forums at powerusers.microsoft.com
Hi Reza - can we do conditional trigger based on a particular date ? E.g. trigger email only if selected date was after 10-Oct-2020
I am trying to create a trigger an email through power automate basis the date updated in MA forms
If using Microsoft Forms, then you cannot use trigger conditions since you would need the details of the form which is not available in the trigger.
If using any ohter data source, if the trigger has the date then you can plug in your trigger condition for date.
You would need some help with expressions.
aka.ms/learnexpressions
@@RezaDorrani thank you. I will check the expressions videos that you have shared.
Thank you once again for your videos
how about if i have group of people who wish not to re-route the workflow when they modified a certain item in sharepoint? how can i do that?
I am assuming by re-route you mean retrigger. In that case you would have to check wether any of those users have not modified item in trigger condition. May be a long query depending on how many users.
First Congratulations for your video.
I have a question...
How create a loop condition in power automate on cloud? For example: There is a condition, when the result is NOK, return to before step, and, if the condition is OK, follow to next step to finish the flow.
Can you help me with this?
Thank you.
There is no return to step in flow.
However, you can design do until loops & exit conditions. Your scenario is possible but I would have to try it out.
I would recommend you post your issue/query with screenshots on the forums at powerusers.microsoft.com
@@RezaDorrani Thanks for help me.
Hello Reja, Thank you for sharing, It's very helpful. I've question on flow sharepoint item modified trigger. If I use this and send email, Modified by columns is updated by the flow user and in email it shows - Updated by flow user. Where as this items is updated by some other user. How to get the user name, who is edited the item in flow. Appreciate any suggestion/ help on this. Thank you.
When flow triggers you can store the modified by in a variable prior to updating the list item. That ways when you send the email, you can use the original modified by user name.
@@RezaDorrani Yes Reja, I did the same, But it was taking my name (flow owner) always, as I was triggering the flow. Now I got tested by other users, Modified By is coming up properly.
Thank you.
Hi Reza,
how can I prevent the users updating the colum runttheflow by using ms access for example. I can disable the quick edit, but how can I lock the scenario with ms access and allow only this published form with invisible fields?
Hi Alex. I am not sure about MS Access. I don't think that's possible with MS Access
@@RezaDorrani Thank you. I will try it out.
One more question about power automate license. Do I need an extra license if I had already M365 E3 to use the premium connector?
@@thecoreYalex Yes. All premium connectors needs premium licensing.
Hi Reza
I Get changes for an item or a file Error BedGateway "retries occurred" Could you help please?
I will have to look at your flow in action to provide guidance. I would recommend posting your issue/query with screenshots on the forums at powerusers.microsoft.com
Hi Reza
I think your solutions to avoid the infinite flow run is so great. I applied to my flow and received the errors msg below:
The power flow's logic app flow template was invalid. The template condition expression 'not(equals(triggerBody()?['Editor']?['Email'],'mimi@american.edu'))' at line '1' and column '90806' is not valid template language expression.
Would you please help me to fix this? Much appreciated your help!
Firstly thanks for watching.
Your expression begins and ends with single quotes- you do not need that
Also ensure your expression starts with @ symbol when adding it to the trigger condition
@@RezaDorrani Thanks Reza, that worked great - Thanks again!
@@RezaDorrani
Hi Reza,
I changed my email to the Admin owner email as below:
@not(equals(triggerBody()?['Editor']?['Email'],'svco365spadmin@american.edu'))
and I received this message:
The power flow's logic app flow template was invalid. The template condition expression '@not(equals(triggerBody()?['Editor']?['Email'],'svco365spadmin@american.edu'))' at line '1' and column '103379' is not valid template language expression.
Is the additional single codes caused by this problem? Best Regards! myle
@Reza Dorrani After reloading the flow, the first solution is working nicely. BIG KUDOS!!!
@@myleluong8488 Great
Hey @Reza, Is it possible to send an email from the person's account who created the item in share point list not default from the person who created this list or flow.
Automated flows always run under the context of its connectors.
So the email will be sent from the account configured in flow.
You cannot send email from account of person who created the item in this scenario.
@ Reza, Thank you for the clarification.
Hi,
what do you mean by 'Service account'?, is that the 'SCAdmin account'
I mean any account in Azure AD that can act like a service account. A dedicated account for the flow.
Hello Sir, I tried this but this is not working for OnPrem SharePoint as I am using gateway connection in "Anyaccess\userid" format, can you please help me how to prevent race condition for OnPrem SharePoint.
I will have to look at your flow in action to provide guidance. I would recommend posting your issue/query with screenshots on the forums at powerusers.microsoft.com
triggerBody is not available for me only triggerOutputs.
What is wrong?
My workflow will not run with @equals(triggerOutputs()?['body/RunTheFlow'],'yes')
May be the schema changed (should not be the case though). User triggerBody in that case and try out
Use triggerBody
@@RezaDorrani Made a new workflow and used "triggerBody" and I received an error.
"The power flow's logic app flow template was invalid. The template condition expression 'equals(triggerBody()?['RunTheFlow'],'yes')' at line '1' and column '1677' is not valid template language expression."
Forgot to add the @ at the begining but the workflow doesnt trigger.
Investigating now. Really appreciate the help.
Your instructions were great but something else is going on, on my end, thats causing an issue.
thank you for this
Your most welcome
Mine doesnt start the flow for the first time.. after using the code, I want to be able to run the code only once..
Check your flow trigger.
I would recommend to post your issue with screenshots here for further assistance - powerusers.microsoft.com/t5/General-Power-Automate/bd-p/MPAForum
can you please send Trigger condition text, bez am unable to see clearly on Video...Thank you
For infinite loop - @not(equals(triggerBody()?['Editor']?['Email'],'email address'))
For SharePoint column is updated - @equals(triggerBody()?['runtheflow'],'yes')
It looked helpful but when I tried it didn’t break the loop. I am still facing the same issue.
I have not come experienced the mentioned issue and hence not sure what is the cause for your issue. I recommend posting your issue/query with screenshots on the forums at powerusers.microsoft.com in case someone has experienced something similar
Can anyone help me to write a workflow to update hyperlink and description?
I will recommend you check on the forums at powerusers.microsoft.com/
Already been to these links and breaking my head on making a json script work no luck yet
@@kaushikkundu3740 forums will be your best bet or you may need to get someone to come on a teams call and help.
Have u ever tried this ?
@@kaushikkundu3740 No
Thanks- I have to get into “ant” mode and save it for a rainy day
Every day is a rainy day :)
Never stop learning.
Can i get some help on this?
What’s the issue?
@@RezaDorrani So I want to set up reminder workflows, I have the
"when item is modified" as an automated workflow. Problem is when the item changes it starts another workflow which is fine, but it wont terminate the previous workflow.
Essentially the logic is
Document Name: excel approve
Assigned To: Jake Man
Workflow will begin and send reminder emails every 15 minutes up to an hour and then after that once a day( which is done). I want the flow to terminate when its no longer assigned to Jake Man. The thing is, it starts another workflow and that is terminated because it is not that person, but the previous flow is still running, going through an infinite loop and sending emails even though it is no longer assigned to that person anymore.
If i was to put the reminder emails inside the main approval workflow, the problem would be the delay. I cant cancel the delay action even when the variable has been changed. So you would only get reminder emails again after a full day and then it would reset to every 15 minutes again. So the best thing I can think of is use an automated workflow which will terminate when it is no longer assigned to that person and still create another workflow checking if it equals it.
@@mrwhammer I have not covered or showcased a scenario like this in any of my videos. I would have to recreate your scenario and then try and figure out a solution.
I would recommend posting your query on forums. May be someone has done something similar.
powerusers.microsoft.com
how to do with in power automate instead of using power apps form
Key is to have that flag reset in order for the infinite loop to be avoided and hence the power app form helps.
You could use a different approach wherein you set a date and time field to today's date and time.
Then if flow is retriggered, you can compare the temp data and time column value with the item modified date and time and accordingly decide whether to trigger the flow.
Service a.c is a good option
👍
"@not(equals(triggeredBody()?['Editor']?['Email'],'____________')) You're welcome
The flow will not trigger for the email id provided in the trigger condition.
And you are welcome too :)
Power Automate Sucks
Why do you say so?
when I use @equals(triggerBody()?['runtheflow'],'yes') for trigger condition, I am receiving
ERROR.--- Cannot read properties of undefined (reading 'properties')
Any idea what might be the reason.
I will have to look at your flow in action to provide guidance. I would recommend posting your issue/query with screenshots on the forums at powerusers.microsoft.com