cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
msparr
Level: Powered On

Sending an email at the end of flow

I am creating a flow that has multiple switches and preceeding approvals, at the end of the flow, I would like an email to be sent that sends a link to the sharepoint list. Though I only want the email to be sent for the Yes responses. I do not want 7 separate emails sent. Here is my flow

 

Microsoft Flow.png

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Sending an email at the end of flow

@msparr:

 

Here is a simple example of how to accomplish you goal - there is more than 1 way to get there (I could have used an array).

 

I neglected to add a link to the list item but that can easily be added to the email.

 

 First, I declare a string variable before the switch statements

Swirch1.jpg 

Next, in each switch statement, if the request is approved, I append to the string variable - note that the string ends with a <br>

Swirch2.jpg  

Finally, I check to see if the variable has been populated.  If so, I reference it in an email.  The email must have "is HTML" set to yes.

 

Swirch3.jpg 

The email looks like this:

Swirch4.jpg 

Give it a try and let me know if this works for you.  

If so, please mark your post as Solved.

 

Scott

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

10 REPLIES 10
Super User
Super User

Re: Sending an email at the end of flow

@msparr:

 

Since you are using a switch statement, only one approval should run.  Why not add an a condition and an email action immediately after each approval.  The condition checks to see of the item was approved.

 

If this addresses your issue, please mark your post as solved.

 

Scott

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
msparr
Level: Powered On

Re: Sending an email at the end of flow

Actually, multiple switches can apply. There are 7 switches, any combination of switches can apply. each have their own approval flow. If I do as you suggested, I will get up to 7 separate email. 

Super User
Super User

Re: Sending an email at the end of flow

@msparr:

 

In that case, initialize an array variable before the switch statements.  If an item is approved, then append to the array.  After the switch statements, evaluate the array and send an email as appropriate.  You could convert the array into an HTML table and insert the table into the email if you want.

 

You could use a compose action as well.

 

Scott

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
msparr
Level: Powered On

Re: Sending an email at the end of flow

Here is my powerapp and sharepoint list, if it helps to show the workflow 

PowerApps.pngList_Settings.jpg

msparr
Level: Powered On

Re: Sending an email at the end of flow

Thank you for your response Scott! Do you happen to know a good resource to help me set this up? I'm strugging to understand arrays and how to apply it to my flow.

Super User
Super User

Re: Sending an email at the end of flow

@msparr:

 

I'll update this post with an example later today or tomorrow.

 

Can you tell me if, for the purposes of your email, all you need to know is that a certain value is set to "yes" or is there additional info that should be there as well.  In other words, if "G Drive" is set to on, is that all you need in the email or is there other info that should be there as well that relates to the "G Drive".  Basically, I'm asking if there should be more than 1 column in the array/collection.

 

Scott

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
msparr
Level: Powered On

Re: Sending an email at the end of flow

All I need to know for GDrive is that it is 'on'. Though, going back to the original idea, I need the email to bring together all switches that = 'on'. So the Array would be something like: (if i understand)

Gdrive Yes

Hdrive Yes

Idrive Yes 

Kdrive Yes 

and so on. 

If the answer is 'No' then it does nothing. 

 

 

Highlighted
msparr
Level: Powered On

Re: Sending an email at the end of flow

I tried to do this, but its still not working. Here are my steps

 

1. When an item is created

2. compose- createarray

3. Initialize variable

4. switch

5. approval yes or no

6. if yes, append to an array

7. create html table

8. Filter array 

 

Here are some screenshots1_Microsoft Flow.png

2-flow.png3-flow.png

 

 

Super User
Super User

Re: Sending an email at the end of flow

@msparr:

 

Here is a simple example of how to accomplish you goal - there is more than 1 way to get there (I could have used an array).

 

I neglected to add a link to the list item but that can easily be added to the email.

 

 First, I declare a string variable before the switch statements

Swirch1.jpg 

Next, in each switch statement, if the request is approved, I append to the string variable - note that the string ends with a <br>

Swirch2.jpg  

Finally, I check to see if the variable has been populated.  If so, I reference it in an email.  The email must have "is HTML" set to yes.

 

Swirch3.jpg 

The email looks like this:

Swirch4.jpg 

Give it a try and let me know if this works for you.  

If so, please mark your post as Solved.

 

Scott

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

msparr
Level: Powered On

Re: Sending an email at the end of flow

Scott- I cannot thank you enough! This works perfectly!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 169 members 4,503 guests
Please welcome our newest community members: