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
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.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (2,433)