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?
There is action in Flow called Delay:
There is also described how to use it - https://docs.microsoft.com/en-us/flow/run-scheduled-tasks.
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?
Please see Flow example below on screen:
For notification I used this Expression
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.
Hope this will help you.
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.
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.
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:
My flow's configuration as below:
Within "Delay Until" action, select Timestamp field. Within right panel, click "Expression" tab, then type the following formula within formula box:
And last, click "OK" button.
The flow works successfully as below:
More details about the WDL expression in Microsoft Flow, please check the following article:
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....
Okay @vecerpa I tried that and I get an error when I try to use the formatDateTime function.
I must be doing something wrong. Any help is appreciated.
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
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.
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.
Details of the recurrence and get items steps:
How your Get Items Filter Query field could look like:
where the fx is the expression (assume in the above that your ExpirationDate is without time!):
Keep on trying! 🙂 Kind regards, John
Thanks @JohnAageAnderse very helpful! I was trying to figure it out and I was sinking! This helps a great deal. Love this community!
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.
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
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!
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 😄
Kind regards, John
Check out the new Process Advisor community forum board!
Check out new user group experience and if you are a leader please create your group
On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks