Forum Discussion
Send an email when we assign a task in a list
- Sep 24, 2021
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
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
- VSTrathSep 24, 2021Copper ContributorWorried that I'm now having a lot of columns that are only there to facilitate flows rather than useful for the users who will be referring to the list essentially as their dashboard. I know you can hide columns but is there a better way?
- RobElliottSep 24, 2021Silver Contributor
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
- VSTrathSep 24, 2021Copper ContributorOK - thank you for your help Rob
- VSTrathSep 24, 2021Copper ContributorOne other thing - do you know how I add just a person's name rather than their whole MS profile into an email? I want to tell the user who has been assigned to their enquiry but the People choice column in my list uses their MS profile so I'm getting a long string of information appear in the email when it sends.
- RobElliottSep 24, 2021Silver Contributor
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