cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jamesantony
Advocate I
Advocate I

Need Help with date comparison

Hi there,

 

I am creating an app to capture service anniversary dates in Sharepoint.

In Flow I have a scheduler that runs every day 00:00 and it should pick the service date in each record and compare it with current date. if it matches then it should send an email.

 

Sounds simple and I am fairly new to Flow so struggling a lot. Please help.

 

I tried with this - but it says the format is wrong. and I dont know if I need the apply to each or items etc. please shed some light experts.

 

@Equals(ticks(formatDateTime(items('Apply_to_each')?['Service_x0200_Date'])), ticks(utcnow())

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-zhos-msft
Solution Sage
Solution Sage

Hi @jamesantony ,

Are the service anniversary dates stored in the SharePoint list?

Here I have made a test on side, the dates are come from a list column.

The expression in the condition is:

formatDateTime(items('Apply_to_each')?['Service_x0020_date'],'yyyy-MM-dd')
is equal to
formatDateTime(utcNow(),'yyyy-MM-dd')

 

Capture2.PNG

Best Regards,

Community Support Team _ Zhongys

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

View solution in original post

4 REPLIES 4
v-zhos-msft
Solution Sage
Solution Sage

Hi @jamesantony ,

Are the service anniversary dates stored in the SharePoint list?

Here I have made a test on side, the dates are come from a list column.

The expression in the condition is:

formatDateTime(items('Apply_to_each')?['Service_x0020_date'],'yyyy-MM-dd')
is equal to
formatDateTime(utcNow(),'yyyy-MM-dd')

 

Capture2.PNG

Best Regards,

Community Support Team _ Zhongys

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

v-zhos-msft
Solution Sage
Solution Sage

Hi @jamesantony ,

Are the service anniversary dates stored in the SharePoint list?

Here I have made a test on side, the dates are come from a list column.

The expression in the condition is:

formatDateTime(items('Apply_to_each')?['Service_x0020_date'],'yyyy-MM-dd')
is equal to
formatDateTime(utcNow(),'yyyy-MM-dd')

 

Capture2.PNG

Best Regards,

Community Support Team _ Zhongys

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

View solution in original post

@v-zhos-msft 

 

For the life of me I cannot get this to work.  I get the below error.  I'm assuming here that 'Service_x0020_date' is the name of the column?  My column name is 'Show Date' and it keeps erroring out.  

 

Unable to process template language expressions for action 'Condition' at line '1' and column '28207': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.

 

Any help is appreciated. 

 

Kevin Wolf

JSullivan
Frequent Visitor

For me, this is matching on all rows, not just the two that have today's date.

 

@equals(formatDateTime(items('Apply_to_each')?['DueDate'], 'yyyy-MM-dd'), formatDateTime(utcNow(),'yyyy-MM-dd'))

 

JSullivan_0-1618434039536.png

 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,311)