cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JustinD
New Member

Sending emails when a dropdown menu is changed to a specific answer

Hello All.

 

This is the first time ever posting here. Hopefully, this isn't too easy.

 

I have a SharePoint that collects entries from a particular form. It lists all the form entries. This SharePoint list is used by one of my teams to update the status of a request. 

 

There is a dropdown option in the list that allows agents to select "Approved by A", "Approved by B", "rejected", or "waiting for review". 

I would like to make a flow that sends an email (v2) out to the submitter when the request is either updated to "Approved by A" or "Approved by B".

I'm finding it very difficult to work out a system that would work for this specific niche. Do you have any ideas of how I can make the flow recognize the specific change in a dropdown status to work as a trigger?

1 ACCEPTED SOLUTION

Accepted Solutions
Rhiassuring
Resident Rockstar
Resident Rockstar

"Hopefully, this isn't too easy." 😂

It's never easy when you're new to Power Automate! 

This is totally doable, let's go through the steps together, keeping the following in mind:

1) An email should be sent when it is Approved.
2) It needs to be sent to the form submitter. 
3) It shouldn't do anything if the same column is set to Rejected or Waiting for Review!

And I am going to make the assumption that you have grabbed the email / user profile of the submitter, and that it resides in your list. 

Step 1 - Let's create a "When an item is modified" - BUT - we're going to make sure that dang thing doesn't trigger unless we want it to. To do that, click on the ellipses > Settings > and add a Trigger Condition. Yours will look like this: @contains(triggerOutputs()?['body/Status/Value'],'Approved by') - where "Status" is your field containing the dropdown.

Step 2 - Okay, so now it's ONLY going to run when it's Approved by A or B - but - what if we've already sent an email previously, and it just got modified again so the dropdowns the same? To avoid that, we can use "Get Changes.." to ensure this status is different than the last run.  The formula I use here is just saying to take the current version number of the file that triggered the run, turn it into a number from text, and subtract one from it.  

sub(int(triggerOutputs()?['body/{VersionNumber}']),1)

Rhiassuring_0-1650683337649.png


Step 3 - Create a condition - we're going to use the output from the "Changes" action called "Has Column Changed: Status" - it makes it easy for us. If it's "true", we want to proceed. If it's "false", we want to end the flow. (Keep in mind, if it has changed from "Approved by A" to "Approved by B" and back again, it won't be able to tell, and will email. Let me know if that's a scenario you need to avoid.) 

Rhiassuring_1-1650683960127.png


Step 4 - Create a switch (on the "Yes" side of your condition) that evaluates the "Status Value" from your initial file output. Then, each "Case" will be "Approved by A" and then "Approved by B'. You can either set a variable in here (ie, txtEmail set to ApproverA@ABC.com), or you can straight-up create your emails in here, if they're short and/or need to differ.

Rhiassuring_3-1650684061858.png


And, when you add your email, your "To" would just be to the Email field from your initiating item, or to the "Submitter Email" (You'll note that if you use a person field, it'll show Submitter DisplayName, Submitted Email, Submitter Department, etc - "Email" auto-grabs the email so you don't need to go through any silliness to retrieve it.) 

Let me know how you do with this.

Cheers,

 

Rhia

 

View solution in original post

5 REPLIES 5
Rhiassuring
Resident Rockstar
Resident Rockstar

"Hopefully, this isn't too easy." 😂

It's never easy when you're new to Power Automate! 

This is totally doable, let's go through the steps together, keeping the following in mind:

1) An email should be sent when it is Approved.
2) It needs to be sent to the form submitter. 
3) It shouldn't do anything if the same column is set to Rejected or Waiting for Review!

And I am going to make the assumption that you have grabbed the email / user profile of the submitter, and that it resides in your list. 

Step 1 - Let's create a "When an item is modified" - BUT - we're going to make sure that dang thing doesn't trigger unless we want it to. To do that, click on the ellipses > Settings > and add a Trigger Condition. Yours will look like this: @contains(triggerOutputs()?['body/Status/Value'],'Approved by') - where "Status" is your field containing the dropdown.

Step 2 - Okay, so now it's ONLY going to run when it's Approved by A or B - but - what if we've already sent an email previously, and it just got modified again so the dropdowns the same? To avoid that, we can use "Get Changes.." to ensure this status is different than the last run.  The formula I use here is just saying to take the current version number of the file that triggered the run, turn it into a number from text, and subtract one from it.  

sub(int(triggerOutputs()?['body/{VersionNumber}']),1)

Rhiassuring_0-1650683337649.png


Step 3 - Create a condition - we're going to use the output from the "Changes" action called "Has Column Changed: Status" - it makes it easy for us. If it's "true", we want to proceed. If it's "false", we want to end the flow. (Keep in mind, if it has changed from "Approved by A" to "Approved by B" and back again, it won't be able to tell, and will email. Let me know if that's a scenario you need to avoid.) 

Rhiassuring_1-1650683960127.png


Step 4 - Create a switch (on the "Yes" side of your condition) that evaluates the "Status Value" from your initial file output. Then, each "Case" will be "Approved by A" and then "Approved by B'. You can either set a variable in here (ie, txtEmail set to ApproverA@ABC.com), or you can straight-up create your emails in here, if they're short and/or need to differ.

Rhiassuring_3-1650684061858.png


And, when you add your email, your "To" would just be to the Email field from your initiating item, or to the "Submitter Email" (You'll note that if you use a person field, it'll show Submitter DisplayName, Submitted Email, Submitter Department, etc - "Email" auto-grabs the email so you don't need to go through any silliness to retrieve it.) 

Let me know how you do with this.

Cheers,

 

Rhia

 

Hi Rhia.

 

Thanks for your help with this. I still haven't figured out the "compose" part, but I think I can try and work it out. 

However, I do have a question about the triggers. Since I have two instances when I want this ran, should step 1 have two different triggers? 

For example:
@contains(triggerOutputs()?['body/Status/Value'],'Option1')

@contains(triggerOutputs()?['body/Status/Value'],'Option2')

Rhiassuring
Resident Rockstar
Resident Rockstar

Hey @JustinD , 


When you add multiple triggers, they must all evaluate to true. 

If you're wanting, instead, for it to be "if Option1 is selected OR if Option2 is selected", you can combine them into an "OR" statement.

 

So - something like, @or(contains(triggerOutputs()?['body/Status/Value'],'Option1'), contains(triggerOutputs()?['body/Status/Value'],'Option1'))

 

 

What's going on with your Compose? 

JustinD
New Member

My issue with the compose section is that I'm just unfamiliar with how they work. I'm trying to pick it up myself. 

Update: I am getting some errors in the "Get changes for an item or a file" section. The error is 400 Invalid format for version input value

 

Could this maybe be because I don't have an "until" section?

JustinD
New Member

I was able to work through the rest. Thanks so much for your help with this!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (2,908)