cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JKnox
Level: Powered On

Error Sending Notification based on date comparison

 
Attempting to send an email based on an SP Date field called Expiration Date. 7 Days after the expiration date a notification should be sent. I tried using a condition, compose, filter array and  double checked my formats and all fail. 
 
 Formula:
 
 
@equals(formatDateTime(item()?['Expiration_x0020_Date'], 'yyyy-MM-dd'), formatDateTime(addDays(utcNow(), 7), 'yyyy-MM-dd'))
 
Error:
 
''InvalidTemplate. The execution of template action 'Filter_array' failed: The evaluation of 'query' action 'where' expression '@equals(formatDateTime(item()?['Expiration_x0020_Date'], 'dd-MM-yyyy'), formatDateTime(addDays(utcNow(), 7), 'dd-MM-yyyy'))' failed: '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.'.''
 
6 REPLIES 6
Community Support Team
Community Support Team

Re: Error Sending Notification based on date comparison

Hi @ JKnox,

 

Could you please share a screenshot of the configuration of your flow?

The error message told that the provided "Expiration Date" is null, please check if the "Expiration Date" in the item is null, you could have a try to add a condition to check if the "Expiration Date" is null.

 

Could you please share more details about the trigger in your flow?

If you would like to check the "Expiration Date" of all items in the sharepoint list, you could create a flow as screenshot below:

Capture.PNG

The expression in the condition as below:

@not(empty(items('Apply_to_each')?['Expiration_x0020_Date']))

The expression in the condition 2 as below:

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

 

The flow would run successfully as below:

Capture.PNG

 

 

 

 

Regards,
Alice Zhang

JKnox
Level: Powered On

Re: Error Sending Notification based on date comparison

Hi @v-yuazh-msft - Unfortunately, your suggestion did not work. After I adjusted the flow to your specifications I received notifications for all items on my list with any Expiration Date. The trigger on my workflow is Recurrence.

Configuration-  Recurrence, Get Items (Filtered by Status and LOB) the filter that array based on the expiration date comparison. After it would send a notification.

 

Community Support Team
Community Support Team

Re: Error Sending Notification based on date comparison

Hi @ JKnox,

 

Could you please share a screenshot of the configuration of your flow?

Could you please share more details about the sharepoint list?

 

Further,could you please share more details about what you want to achieve and what is the problem when you create the flow so we could try to help you.

 

 

Regards,
Alice Zhang

JKnox
Level: Powered On

Re: Error Sending Notification based on date comparison

@v-yuazh-msft

 

Screenshshots - I have attempted in several browser to add screenshoots to the conversation and I am unable to. (Yes I have adjusted my security settings). Is there another way I can send you screenshots.

 

SharePoint List- Basic Custom list with 1 look up field.

 

Purpose of Flow - To send a notification on a specific date based on another day. For example the Expiration date is set to 3/31/2018, I would like to send a notification 7 days prior.

Community Support Team
Community Support Team

Re: Error Sending Notification based on date comparison

Hi @ JKnox,

 

 

I have made a test on my side, and the solution that I have provided in worked on my side, please take a try to my solution again, and you could modify the trigger to recurrence.

Please make sure you have add the condition2 that I have provided, and fill in the correct expression in condition2. 

 

Regards,
Alice Zhang

JKnox
Level: Powered On

Re: Error Sending Notification based on date comparison

I tried it again. It sends emails for all the items in the list that do not meet the condition. I have over 1,000 items on my list. Only 2 meet the condition of Exp date +7.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 185 members 3,888 guests
Please welcome our newest community members: