cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dovetail
Helper II
Helper II

Flow to send a customized mail based on a filter

Hi there,

I am new to Power Automate and in seek of help.

I have a Leave request app designed in Power apps for my organisation, which allows employees to request leave and the manager to approve it.

I would like to create a flow that will send a customized mail to HR once a manager has approved a leave request.

In layman's terms, I would like to create a flow that will filter the Status column in my sharepoint list so that whenever the status changes to approved, a customized email is sent to HR informing them about the approve leave.

Any help would be appreciated please, i am really stuck.

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
bluehoodie
Resolver II
Resolver II

Hi @Dovetail 

1. Select “create items when modified/created” under sharepoint connector as the automated trigger

2. Select get items under sharepoint connector

3. Select the condition connector and set your condition where status is equals to approve

4. Send a mail and add in the details of your customised email

View solution in original post

15 REPLIES 15
bluehoodie
Resolver II
Resolver II

Hi @Dovetail 

1. Select “create items when modified/created” under sharepoint connector as the automated trigger

2. Select get items under sharepoint connector

3. Select the condition connector and set your condition where status is equals to approve

4. Send a mail and add in the details of your customised email

Hi there, Okay i followed the steps you outline but my flow is failing with the following error:

Dovetail_0-1594820413384.png

 

This is my flow:

Dovetail_1-1594820578786.png

I really have no idea what is causing the error. it says folder not found and i am pretty sure i got the path right.

Anybody please help.

 

Thank you

 

Hi @Dovetail ,

 

Can you try removing the status field from the limit entries to folder field?

 

 

Hi @bluehoodie 

It runs without errors, thank you very much.

I however find myself with another predicament. The flow sends a mail for a every request with an approved status, even those there were approved in the past, so i find myself with mails of approvals that i already know of.

I would like it to send a mail ONLY for the request that has just been approved.

How would i achieve that?

Thank you

You can have another column in sharepoint that indicates if the mail has been sent to hr and add that to your condition flow to filter out those that have been sent

Okay,

 

Sorry to bother you so much, but could you please walk me on how to do that.

I know how to add the extra column in Sharepoint, but i wouldn't know how to indicate in the column if a mail has been sent to HR and to filter them out in my flow.

your assistance would be greatly appreciated.

 

thank you

Hi @Dovetail ,

 

Under the condition branch, add in a new role where <email_sent column> = no and <status column> = approve

 

After your send an email flow, select the update item from sharepoint connector and update the email_sent column = yes

Hi @bluehoodie 

 

I am not sure i understand the last part where you say i should select the update item.

 

I however creates the extra column that will indicate if a mail has been sent or not, but it currently has no data.

below is also a snipped of the condition.

Dovetail_0-1594826823543.png

 

Hi @Dovetail ,

 

For your current data set, for those that you have already sent an email, you can set the email_sent column to Yes. For those that are new, it will be empty or no (depending on how you set it when the manager approves the request)

 

Once an email is sent, you can update the email_sent column as follows:

bluehoodie_0-1594827176587.png

 

Hi @bluehoodie 

Thank you, i did as requested and i think i'm on the right track.

The flow runs without any errors, but it is skipping the send an email(v2) and Update item flow. My mails is not being sent and my column isn't updating

 

please see my snippet below:

Dovetail_0-1594829682195.png

Do you perhaps know what the issue is?

Hi @Dovetail ,

 

Your conditions are not met which is why the mails are not sent and the columns are not updated. Is there a row in your sharepoint list where email_sent = no and status = approved?

Hi @bluehoodie 

Please see a snippet of my column below. for those that mails were already sent, i manually set it to Yes, however the others are blank, and i think that is why my condition is failing.
Do i need to manually put in a "NO" for those that have not been sent yet?

Is there a way to make them populate automatically? If a mail is not sent yet, it would be a NO and it would change to Yes once it has?

Dovetail_0-1594879422368.png

 

Thank you

 

 

 
 

 

 

Hi @Dovetail ,

 

Can you set the condition to if email_sent is equal to null instead of no?

 

something like this

https://www.google.com.sg/amp/s/www.spsimply.com/home/2019/1/10/flow-make-a-condition-to-check-for-e...

Hi @bluehoodie 

Thank you very much.

the flow works as it should, the mail is being sent and the the list is being updated.

What is weird that the condition expression result is still False. do you perhaps know why this is still happening although the flow is working fine.

Dovetail_0-1594888578238.png

Might this be a bug?

Hi @Dovetail ,


The condition is supposed to be true. It doesnt look like the mails got send out fron your screenshot as the condition is not met. i do face issue with the null function at times. My workaround is to use the length() expression for the email_sent field to be equals to 0.

 

 

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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
Top Kudoed Authors
Users online (3,553)