cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Send email after 30 days?

Hi, I'm new to writing flows and I have my current approval flow working but I need to add a follow up email based on the expiration date. So, I have emails going on for approval and once it is approved. The document expires 30 days after it is posted and I want to send an email to the creator to take the document down on the expiration date. So far, it sends the email immediately. Does anyone know how I can send the last email 30 days after the flow is created?

 

Thanks,

Kathy

 

18 REPLIES 18
Highlighted
Power Participant
Power Participant

Re: Send email after 30 days?

Hi @kmason,

 

There is action in Flow called Delay:

Flow_Delay.PNG

 

There is also described how to use it - https://docs.microsoft.com/en-us/flow/run-scheduled-tasks.

P.

Highlighted
Helper III
Helper III

Re: Send email after 30 days?

Thanks @vecerpa I tried that but it wants a specific day and I want the email to run on the expiration date I have in my list. Any thoughts on how to use it with that?

 

Thanks!

Highlighted
Power Participant
Power Participant

Re: Send email after 30 days?

Hi @kmason,

 

Please see Flow example below on screen:

Flow_Delay1.PNG

 

For notification I used this Expression

 

formatDateTime(addDays(triggerBody()?['Created'],30),'dd/MM/yyyy')

And for delay I added 30 days to Created metadato of added doc in doc library in sharepoint for example. I can pick another source for example if you store it in excel, list, whatever.

 

addDays(triggerBody()?['Created'],30)

Hope this will help you.

P.

 

 

 

 

Highlighted
Helper III
Helper III

Re: Send email after 30 days?

Thanks, I think I need more help with the expressions. When I typed in the expression you suggested I got a message saying it didn't exist. or it wasn't a valid expression.  I think it is because of my lack of knowledge in this area. I'm learning all of this on the fly, on my own by watching videos and reading blogs. My company isn't big on getting us training unfortunately.

 

Highlighted
Power Participant
Power Participant

Re: Send email after 30 days?

Hi, can you post at least print screen of your Flow?

P.

Highlighted
Helper III
Helper III

Re: Send email after 30 days?

Set Delay part of flow.png

Highlighted
Helper III
Helper III

Re: Send email after 30 days?

It is an approval Flow and this is the second I'm having trouble with. So after an item is approved, it is only good for 30 days and then I need to send an email out to the creator telling them the item has expired.

Highlighted
Community Support
Community Support

Re: Send email after 30 days?

Hi @kmason,

 

Is the document uploaded into a SharePoint library?

Could you please share a full screenshot of your flow's configuration?

Do you want to send an expiration email based on the Expiration date property or after 30 days?

 

If you only want to send an expiration email after 30 days, I agree with @vecerpa's thought alomost. But if you want to send an expiration email based on the Expiration date property, please take a try with the following workaround:

 

I have created a custom column called Expiration date in my SharePoint libray, which is a Date type column. The data structure of my SharePoint library as below:18.JPG

My flow's configuration as below:19.JPG

 

Within "Delay Until" action, select Timestamp field. Within right panel, click "Expression" tab, then type the following formula within formula box:

formatDateTime(triggerBody()?['Expiration_x0020_date0'],'yyyy-MM-ddTHH:mm:ssZ')

And last, click "OK" button.

 

The flow works successfully as below:20.JPG

 

 

More details about the WDL expression in Microsoft Flow, please check the following article:

https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language

 

Best regards,

Kris

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper III
Helper III

Re: Send email after 30 days?

Yes, I have a column in my SharePoint list for Expiration Date. I am going to try your fix and see if I can get it to work. I will let you know how it goes. Thanks for all y our help with this it is much appreciated. This is the final piece I need to get worked out before I can release this Flow to my organization so you are helping me out a great deal.

 

I will follow up after I try this....

Highlighted
Helper III
Helper III

Re: Send email after 30 days?

Okay @vecerpa I tried that and I get an error when I try to use the formatDateTime function. 

 

format error.PNG

I must be doing something wrong. Any help is appreciated.

Highlighted
Super User II
Super User II

Re: Send email after 30 days?

I am curious about why you want to combine the approval and the expiration process into one flow. The way I would do it is:

 

1) Approval flow, that sets the expiration date for the document being approved;

2) A recurrent flow, that runs daily and retrieve only documents which have an expiration date equal today. If any documents are found, the creator is informed about it.

 

How does this sound to you? Kind regards, John

Highlighted
Helper III
Helper III

Re: Send email after 30 days?

Hi @JohnAageAnderse thanks for your suggestion. I thought of that but didn't quite know how to get it going. I'm new to Flow and am kind of learning on the fly (thank God for YouTube and Lynda.com!). I may try your suggestion and see if that works better. 

Highlighted
Super User II
Super User II

Re: Send email after 30 days?

Quite allright! Just for your information about recurrent flows, here are some snapshots of one I have running weekly 🙂 Just so you get the idea.

 

Flow overview:

FlowRecurrenceGetItemsSendMail.png

 

Details of the recurrence and get items steps:

FlowRecurrenceGetItemsDetails.png

 

How your Get Items Filter Query field could look like:

FlowGetItemsFilterQueryExample.png

 

where the fx is the expression (assume in the above that your ExpirationDate is without time!):

startOfDay(utcNow())

 

Keep on trying! 🙂 Kind regards, John

Highlighted
Helper III
Helper III

Re: Send email after 30 days?

Thanks @JohnAageAnderse very helpful! I was trying to figure it out and I was sinking! This helps a great deal. Love this community! 

Highlighted
Helper III
Helper III

Re: Send email after 30 days?

Hey @JohnAageAnderse can you help me with what I put in the (...) for the expression. I want it to run once a day if the Expiration Date = Today. I would appreciate it. That is where my disconnect is coming, I'm lost on what to put inside the expressions.

Highlighted
Super User II
Super User II

Re: Send email after 30 days?

The whole expression is startOfDay(utcNow()) - so the (...) that you see in the snapshot, is (utcNow()).

 

utcNow() gives you today's date and time;

startOfDay(utcNow()) gives you today's date without time (or time is 00:00:00).

 

The above usage of startOfDay(...) assumes that your expiration date does not contain a time value (or time is 00:00:00)!

 

Tip! When I am unsure what values I am working with, I simply make a Send a mail step and puts the fields into the body, so I can see what the values are when I receive the e-mail.

 

Kind regards, John

Highlighted
Helper III
Helper III

Re: Send email after 30 days?

Thanks @JohnAageAnderse. Would you mind sending me a sample of that step so I can see what you are talking about? That sounds like a fabulous idea. That is one thing I really need to work on is the context inside of the expressions. I'm really trying to master this because I have a lot of Flows I need to write for different departments within my company.

 

Thanks so much!

Kathy

 

Highlighted
Super User II
Super User II

Re: Send email after 30 days?

This is an example of a Send an email step! Just be careful you don't end up with that step inside a Apply to each step - then you may get a lot of emails 😄

 

FlowValuesByEmailExample.png

 

 

Kind regards, John

Helpful resources

Announcements
Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Top Solution Authors
Users online (7,601)