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

Send an email 60 days before due date

Hi,

 

I'm in the middle of creating a flow that will roughly run once a month to check if a users subscription expires in the next 60 days. I can't seem to get this working however and wondering if I'm doing something wrong that I can't see. Here is what my flow looks like:

 

Devinm501_0-1614702670704.png

 

 

In my condition is where I'm going wrong

 

Left side: 

formatDateTime(items('Apply_to_each')?['Clearence - Expiry Date'], 'MM/dd/yyyy')
 
Is less than or equal to 
 
Right side: 
formatDateTime(addDays(utcNow(), 60), 'MM/dd/yyyy')
 
Not sure if this is correct but any guidance would be greatly appreciated.
 
Thank you,
Devin
1 ACCEPTED SOLUTION

Accepted Solutions
RobElliott
Super User
Super User

When you are comparing dates in your flow you must always use the format yyyy-MM-dd. Later on in your flow you can convert a date to the format you want, but for the comparison both dates must be in the yyyy-MM-dd format.

 

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

View solution in original post

5 REPLIES 5
RobElliott
Super User
Super User

When you are comparing dates in your flow you must always use the format yyyy-MM-dd. Later on in your flow you can convert a date to the format you want, but for the comparison both dates must be in the yyyy-MM-dd format.

 

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

thank you rob, I assumed it would be MM/dd/yyyy or even dd/MM/yyyy as this is how its displayed in the sharepoint column itself?

 

does the formula look correct besides this?

@Devinm501 As you've got spaces in your Clearence - Expiry Date SharePoint column name you might need to use _x0020_ in place of the spaces, but you can check the internal name that is being used in the List Settings, select the column then look at the field= in the address bar.

 

Your formula will bring back everything that is less than or equal to today + 60 days, so even tomorrow! You might just want to use is equal to.

 

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

thank you, ive now changed to the column name.

 

For the less than or equal to i used this purely because the flow will only run once a month so if perhaps a expiration date is less than the 60 days after the last run time i need that to be captured also.

I've just entered a dummy date of 06/04/2021 and changed the recurrence to once a minute just to test and apparently it has ran through successfully but i have received no email. When i click on the flow to get the summary i also see this:

 

Devinm501_0-1614704525434.png

It doesnt let me check the condition as its greyed out for some reason, any idea why this would be?

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,454)