Forum Discussion
Send an email when we assign a task in a list
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?
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
- RobElliottSilver Contributor
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- VSTrathCopper Contributor
Thanks RobElliott - however I don't see these advanced options in the last step of adding the Update Item. This is what I get:
- VSTrathCopper ContributorAh sorry ignore me - these appear once I put in the site address and list name. This is great! Will test it now. Many thanks for your reply.
- VSTrathCopper ContributorOK so I tried it and still don't have the Completed field visible on the Update item step to add the utcNow expression. Do I need to create another column in my list for the time of completion or something?
- RobElliottSilver Contributor
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