Search code examples
sharepointpower-automate

Validating SharePoint List's Date Column For NULL Values Throughs Exceptions


I have a SharePoint List that has a column named 'Agreement Review Date'.

I have created a Power Automate Workflow that send an email alert to business managers when the Agreement Review date is today.

However, some of the records contain an empty 'Agreement Review Date'. This is triggering an exception in the 'Apply to each' section only to the records which don't have an empty 'Agreement Renew Date'.

enter image description here

In order to resolve that I tried to send the email alert only for the records that have an 'Agreement Renew Date' and I tried the following conditional statement in Power Automate 'Condition' ---> Parameters

formatDateTime(items('Apply_to_each')?['AgreementReviewDate'],'yyyy-MM-dd') IS NOT EQUAL TO null.

enter image description here

When I checked the next failed attempt, there is an error in the 'Condition section'. Please refer to the below error message.

enter image description here

InvalidTemplate Unable to process template language expressions for action 'Condition' at line '0' and column '0': '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.'.

I am unable to find the root cause of these error messages.

Regards, Chiranthaka


Solution

  • A friend showed me a different solution for the issue.

    It's about using the 'Filter Query' in the 'Get items' action.

    The query string used is:

    AgreementReviewDate ne null
    

    It's just neglect the NULL values in the Agreement Review Date column.

    @skin thank you for your help.