web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Send email 30 days bef...
Power Automate
Answered

Send email 30 days before expiry date

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I have a flow that I cant quite get right. I have a stock list with an expiry date column. I want to receive an email 30 days before the expiry date, reminding me to order some new stock. I have followed guides online and am receiving emails for all items in the list, no matter if the due date is within 30 days or not.

mr-samd_2-1615982433189.png

 

mr-samd_1-1615982308570.png

The formula I am using in the condition is:

formatDateTime(addDays(utcNow(), 30), 'MM/dd/yyyy')

 

any tips on how to get this to work would be appreciated.

Categories:
I have the same question (0)
  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @mr-samd 

     

    Have you considered using a filter on the get items action?  

     

    expirydate le 'formatDateTime(addDays(utcNow(), 30), 'MM/dd/yyyy')'

     

    This uses the column name and requires that the date is in the correct format.  You can check the date format in the history output of the get items actions.

     

    You could then use the Create HTML table action on the results of your get items and simply include the HTML table in you send email with no need for an apply to each or condition.

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien

  • mr-samd Profile Picture
    on at

    Hi Damien, 

    Thanks for your help. I have tried to follow your advice but for some reason the filter is saying its not valid.

     

    The expression "expirydate le 'formatDateTime(addDays(utcNow(), 30), 'MM/dd/yyyy')'" is not valid. Creating query failed.

     

    I dont know if its because im not referencing my list column properly or ive put it in wrong somehow. 

    Any further explanation of how to input this would be very helpful. 

     

    mr-samd_0-1616057144297.pngmr-samd_1-1616057166893.pngmr-samd_2-1616057196813.png

     

  • Verified answer
    DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @mr-samd 

     

    You need to type or paste the expression in the expression tab and not as plain text or it will not evaluate.

     

    paste: formatDateTime(addDays(utcNow(), 30), 'MM/dd/yyyy') into the expression tab, next to the dynamic content tab

     

    Damien

  • mr-samd Profile Picture
    on at

    Oh ok sorry,

    This now gives a new error:

    mr-samd_0-1616057780456.png

     

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @mr-samd 

     

    It's possible that it should be in the format yyyy/MM/dd - give that a go.

     

    Damien

  • mr-samd Profile Picture
    on at

    Sadly that did not help. I think the issue lays with referencing the column. The "expirydate le " bit on the front of the function you gave says its invalid.

     

    expirydate le 'formatDateTime(addDays(utcNow(), 30), 'MM/dd/yyyy')'

  • mr-samd Profile Picture
    on at

    mr-samd_1-1616067871963.png

     

    This is what I am trying and getting the following error:

    mr-samd_2-1616067914699.png

     

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    @mr-samd you're also missing ' ' around the date.

     

    Damien

  • mr-samd Profile Picture
    on at

    THATS IT! Thankyou. 

  • therrean Profile Picture
    76 on at

    I am having the same issue with my flow not working will you be able to help?

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard