cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JKnox
Frequent Visitor

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
Community Support

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
Frequent Visitor

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
Community Support

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
Frequent Visitor

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
Community Support

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
Frequent Visitor

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

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (7,689)