Forum Discussion

DogAndPonyShow's avatar
DogAndPonyShow
Copper Contributor
Feb 09, 2021

Reminder emails - Flow fails when date value is empty

Hi there,


I hope you can help.  I have a flow which sends emails 4 days before a target date as reminders.  The datasource is a SharePoint Online list.

 

The emails are sending correctly for list items which meet the criteria (eg 4 days before the date field value), however the Flow is failing.  This is for items on the SharePoint list where there are blank values for TargetCompletionDate.  Failing on the 'Apply to each' step.

 

The Condition is using the 'addDays' function to check against the 'TargetCompletionDate' value (see screenshot Reminder flow 3.png).

 

On the SharePoint list, TargetCompletionDate is a Date and Time column showing date only in a standard format.

 

The error I see is below.

 

Apply to each:
InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '1' and column '15107': 'The template language expression 'formatDateTime(item()['TargetCompletionDate'],'yyyy-MM-dd')' cannot be evaluated because property 'TargetCompletionDate' doesn't exist
 
I've attached the error screenshot and also 4 screenshots to show the flow.
 
I feel the solution lies in additonal conditions on the flow, but my attempts aren't working.
 
Any help would be greatly welcomed.  Thank you!
 
  • DogAndPonyShow in your Get items action add a filter query of TargetCompletionDate ne '{null}' where {null} is an expression from the Expression tab in the dynamic content box. ne stands for not equal to.  Make sure you include the single quotes around the expression. With this filter it will only bring back items from the list where the TargetCompletionDate actually has something in it so should avoid the error.

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User

  • RobElliott's avatar
    RobElliott
    Silver Contributor

    DogAndPonyShow in your Get items action add a filter query of TargetCompletionDate ne '{null}' where {null} is an expression from the Expression tab in the dynamic content box. ne stands for not equal to.  Make sure you include the single quotes around the expression. With this filter it will only bring back items from the list where the TargetCompletionDate actually has something in it so should avoid the error.

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User

    • DogAndPonyShow's avatar
      DogAndPonyShow
      Copper Contributor

      RobElliott- thank you so much!  That's worked a treat.

       

      If I add a filtered expression 'TargetCompletionDate ne null' - the workflow no longer errors.  Amazing.

       

      Side question: under Dynamic content I don't see any of the SharePoint list columns (screenshot attached) - why would this be?  Thanks.

       

       

      • RobElliott's avatar
        RobElliott
        Silver Contributor

        DogAndPonyShow don't know, I'd have to see what your flow actions before it are.

         

        Rob
        Los Gallardos
        Microsoft Power Automate Community Super User

Resources