SOLVED

Send an email when we assign a task in a list

%3CLINGO-SUB%20id%3D%22lingo-sub-2778564%22%20slang%3D%22en-US%22%3ESend%20an%20email%20when%20we%20assign%20a%20task%20in%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2778564%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20I'm%20trying%20to%20create%20a%20flow%20that%20sends%20an%20email%20to%20a%20user%20to%20let%20them%20know%20who%20is%20handling%20their%20enquiry.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20Sharepoint%20list%20has%20a%20choice%20column%20called%20'Status'.%20I%20want%20the%20flow%20to%20trigger%20when%20the%20choice%20selected%20is%20'Assigned'%20but%20without%20an%20infinite%20loop%20of%20emails%2C%20so%2C%20once%20the%20email%20has%20been%20sent%20I%20also%20want%20to%20update%20the%20list%20item%20to%20change%20the%20status%20to%20'in%20progress'%20instead.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20it's%20still%20telling%20me%20there's%20an%20infinite%20loop%20in%20the%20flow%20checker.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20is%20how%20my%20flow%20looks%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20When%20an%20item%20is%20created%20or%20modified%3C%2FP%3E%3CP%3E2.%20Get%20user%20profile%3C%2FP%3E%3CP%3E3.%20Apply%20to%20each%20%26gt%3B%20Get%20item%3C%2FP%3E%3CP%3E4.%20Condition%20(if%20status%20%3D%20assigned%20send%20email)%3C%2FP%3E%3CP%3E5.%20Update%20item%20(with%20status%20value%20as%20'in%20progress')%3CBR%20%2F%3E%3CBR%20%2F%3EAny%20advice%20on%20what%20I'm%20doing%20wrong%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2778564%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Flow%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerApps%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2781538%22%20slang%3D%22en-US%22%3ERe%3A%20Send%20an%20email%20when%20we%20assign%20a%20task%20in%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2781538%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1164564%22%20target%3D%22_blank%22%3E%40VSTrath%3C%2FA%3E%26nbsp%3Byes%20you're%20flow%20will%20go%20into%20an%20infinite%20loop%20the%20way%20you%20have%20it.%20In%20my%20example%20below%20(prepared%20for%20a%20similar%20question)%20we%20are%20going%20to%20change%20the%20Status%20of%20the%20Bedar%20item%20below%20to%20Completed%20which%20will%20put%20in%20today's%20date%20in%20a%20different%20column%2C%20but%20it%20will%20not%20go%20into%20an%20infinite%20loop.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CU%3EImportant%3A%3C%2FU%3E%20the%20flow%20compares%20the%20current%20version%20of%20the%20list%20with%20the%20previous%20version%20so%20you%20must%20turn%20on%20list%20item%20versioning%20in%20your%20list%20settings.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%220-SPList-Versioning.png%22%20style%3D%22width%3A%20915px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312634i4C0DA7C0BA91E1A6%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%220-SPList-Versioning.png%22%20alt%3D%220-SPList-Versioning.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%225-SPList-StatusChanged.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312639iE48F1FC75A684442%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%225-SPList-StatusChanged.png%22%20alt%3D%225-SPList-StatusChanged.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20your%20flow%20do%20not%20use%20the%20when%20an%20item%20is%20created%20or%20modified%20trigger%20but%20use%20the%20SharePoint%20%22%3CSTRONG%3Ewhen%20an%20item%20or%20a%20file%20is%20modified%3C%2FSTRONG%3E%22%20and%20select%20your%20site%20and%20list%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%221-Flow.png%22%20style%3D%22width%3A%20690px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312635iA9F70743E7388D47%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%221-Flow.png%22%20alt%3D%221-Flow.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENext%2C%20the%20first%20action%20should%20be%20the%20SharePoint%26nbsp%3B%20%22%3CSTRONG%3Eget%20changes%20for%20an%20item%20or%20a%20file%20(properties%20only)%3C%2FSTRONG%3E%22.%20Again%20you%20select%20your%20site%20and%20list%20and%20then%20in%20the%20Since%20field%20add%20the%20following%20expression%20to%20get%20the%20changes%20since%20the%20previous%20version%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23800000%22%3E%3CSPAN%3Esub(int(triggerOutputs()%3F%5B'body%2F%7BVersionNumber%7D'%5D)%2C1)%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%222-Flow.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312637i6CECC600C64DE241%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222-Flow.png%22%20alt%3D%222-Flow.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENext%2C%20add%20a%20condition%20and%20select%20%3CSTRONG%3EHas%20Column%20Changed%3A%20Status%3C%2FSTRONG%3E%20%3CEM%3Eis%20equal%20to%20true%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%223a-Flow.png%22%20style%3D%22width%3A%20797px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312636i58856C2D627C13A0%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%223a-Flow.png%22%20alt%3D%223a-Flow.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20my%20example%20we%20are%20also%20checking%20if%20the%20Status%20is%20now%20completed%2C%20so%20I've%20added%20aother%20line%20in%20the%20condition%20and%20selected%20%3CSTRONG%3EStatus%20value%3C%2FSTRONG%3E%20%3CEM%3Eis%20equal%20to%20Completed%3C%2FEM%3E.%20the%20reason%20it's%20status%20value%20and%20not%20just%20status%20is%26nbsp%3B%20because%20in%20my%20list%20the%20status%20column%20is%20a%20choice%20column.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%223b-Flow.png%22%20style%3D%22width%3A%20846px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312638i360A7D0941489B00%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%223b-Flow.png%22%20alt%3D%223b-Flow.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20leave%20the%20red%20if%20no%20channel%20empty%20because%20we%20don't%20want%20anything%20to%20happen%20in%20that%20case.%20But%20in%20the%20green%20if%20yes%20channel%20add%20an%20%22%3CSTRONG%3Eupdate%20item%22%3C%2FSTRONG%3E%20action%20and%20add%20the%20utcNow()%20expression%20for%20today's%20date%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%224-Flow.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312640iB038E88139EF63F3%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%224-Flow.png%22%20alt%3D%224-Flow.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%226-SPList-Completed.png%22%20style%3D%22width%3A%20972px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312641i1552BA64940A1BD8%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%226-SPList-Completed.png%22%20alt%3D%226-SPList-Completed.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20your%20scenario%20you%20would%20add%20the%20email%20action%20into%20the%20green%20if%20yes%20channel.%20And%20this%20flow%20avoids%20the%20infinite%20loop.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECome%20back%20with%20any%20questions%20about%20this.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERob%3CBR%20%2F%3ELos%20Gallardos%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%20color%3D%22%23006400%22%3EMicrosoft%20Power%20Automate%20Community%20Super%20User%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2781841%22%20slang%3D%22en-US%22%3ERe%3A%20Send%20an%20email%20when%20we%20assign%20a%20task%20in%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2781841%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F174092%22%20target%3D%22_blank%22%3E%40RobElliott%3C%2FA%3E%26nbsp%3B-%20however%20I%20don't%20see%20these%20advanced%20options%20in%20the%20last%20step%20of%20adding%20the%20Update%20Item.%20This%20is%20what%20I%20get%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

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? 

 

14 Replies
best response confirmed by VSTrath (Occasional Contributor)
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.

 

0-SPList-Versioning.png

 

5-SPList-StatusChanged.png

 

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:

 

1-Flow.png

 

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)

 

2-Flow.png

 

Next, add a condition and select Has Column Changed: Status is equal to true

 

3a-Flow.png

 

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.

 

3b-Flow.png

 

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

4-Flow.png

 

 

6-SPList-Completed.png

 

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

Thanks @RobElliott - however I don't see these advanced options in the last step of adding the Update Item. This is what I get: 

 

Ah 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.
OK 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?

@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

Worried 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?

@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

OK - thank you for your help Rob
One 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.

@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

I already have that for the recipient. Will it work to have two different ones?

@RobElliott - hm the flow is showing as complete but the email hasn't arrived in my inbox 

VSTrath_0-1632491563727.png

 

@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

@RobElliott - It created them automatically I think because I need to reference the category in the email body.