Sep 23 2021 06:42 AM
Hi I'm trying to create a flow that sends an email to a user to let them know who is handling their enquiry.
My Sharepoint list has a choice column called 'Status'. I want the flow to trigger when the choice selected is 'Assigned' but without an infinite loop of emails, so, once the email has been sent I also want to update the list item to change the status to 'in progress' instead.
However, it's still telling me there's an infinite loop in the flow checker.
This is how my flow looks:
1. When an item is created or modified
2. Get user profile
3. Apply to each > Get item
4. Condition (if status = assigned send email)
5. Update item (with status value as 'in progress')
Any advice on what I'm doing wrong?
Sep 24 2021 04:12 AM
Solution@VSTrath yes you're flow will go into an infinite loop the way you have it. In my example below (prepared for a similar question) we are going to change the Status of the Bedar item below to Completed which will put in today's date in a different column, but it will not go into an infinite loop.
Important: the flow compares the current version of the list with the previous version so you must turn on list item versioning in your list settings.
In your flow do not use the when an item is created or modified trigger but use the SharePoint "when an item or a file is modified" and select your site and list:
Next, the first action should be the SharePoint "get changes for an item or a file (properties only)". Again you select your site and list and then in the Since field add the following expression to get the changes since the previous version:
sub(int(triggerOutputs()?['body/{VersionNumber}']),1)
Next, add a condition and select Has Column Changed: Status is equal to true
In my example we are also checking if the Status is now completed, so I've added aother line in the condition and selected Status value is equal to Completed. the reason it's status value and not just status is because in my list the status column is a choice column.
You can leave the red if no channel empty because we don't want anything to happen in that case. But in the green if yes channel add an "update item" action and add the utcNow() expression for today's date
In your scenario you would add the email action into the green if yes channel. And this flow avoids the infinite loop.
Come back with any questions about this.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
Sep 24 2021 05:49 AM
Thanks @RobElliott - however I don't see these advanced options in the last step of adding the Update Item. This is what I get:
Sep 24 2021 05:53 AM
Sep 24 2021 06:13 AM
Sep 24 2021 06:16 AM - edited Sep 24 2021 06:17 AM
@VSTrath you must always have the columns in your list if you are going to use them in your flow. But remember to save your flow, close it and then go back into it as the list of columns in the update item action doesn't refresh dynamically.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
Sep 24 2021 06:19 AM
Sep 24 2021 06:21 AM
@VSTrath there are no columns that are only there just to facilitate the flow. Remember, I created this example to answer another question, you will have the columns you need so use those. There are no columns that I have that you need in order to run the flow, use your own columns. It was just an example.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
Sep 24 2021 06:28 AM
Sep 24 2021 06:30 AM
Sep 24 2021 06:34 AM
@VSTrath you'd need to add an Office 365 Users "get user profile (v2)" action, populate it from the people choice column from the dynamic content box then use Given name from the Office 365 Users section of the dynamic content box.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
Sep 24 2021 06:36 AM
Sep 24 2021 06:52 AM
Sep 24 2021 06:56 AM - edited Sep 24 2021 06:56 AM
@VSTrath why do you have those apply to each controls in the green if yes channel? They are not needed and are causing your problem. The only action you need in there is the send an email action.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
Oct 06 2021 07:00 AM
@RobElliott - It created them automatically I think because I need to reference the category in the email body.
Sep 24 2021 04:12 AM
Solution@VSTrath yes you're flow will go into an infinite loop the way you have it. In my example below (prepared for a similar question) we are going to change the Status of the Bedar item below to Completed which will put in today's date in a different column, but it will not go into an infinite loop.
Important: the flow compares the current version of the list with the previous version so you must turn on list item versioning in your list settings.
In your flow do not use the when an item is created or modified trigger but use the SharePoint "when an item or a file is modified" and select your site and list:
Next, the first action should be the SharePoint "get changes for an item or a file (properties only)". Again you select your site and list and then in the Since field add the following expression to get the changes since the previous version:
sub(int(triggerOutputs()?['body/{VersionNumber}']),1)
Next, add a condition and select Has Column Changed: Status is equal to true
In my example we are also checking if the Status is now completed, so I've added aother line in the condition and selected Status value is equal to Completed. the reason it's status value and not just status is because in my list the status column is a choice column.
You can leave the red if no channel empty because we don't want anything to happen in that case. But in the green if yes channel add an "update item" action and add the utcNow() expression for today's date
In your scenario you would add the email action into the green if yes channel. And this flow avoids the infinite loop.
Come back with any questions about this.
Rob
Los Gallardos
Microsoft Power Automate Community Super User