Hi again
I guess the problem is that the following dynamic data:
items('Apply_to_each')?['Contract End']
is sometimes NULL. I guess this means the Contract End value of some SP list items is empty. If so, I would recommend to handle NULL scenarios by means of coalesce() function.
This is a copy paste of a coalesce-based workaround described at https://powerusers.microsoft.com/t5/Flow-Ideas/If-item-equals-Null/idi-p/23308:
I had exact same issue. I was able to work around using the coalesce function listed in Azure's Logic Apps documentation.
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language
Instead of checking for null, I checked if the date was greater than a date far in the past. I wrapped the basic condition generated automatically by flow inside the coalesce function (you have to switch to advanced mode). The coalesce function will not return a null. If your date field is null it returns a "fallback" value that you set in the function. Just set the fallback date less than the date in your condition. In the example below I check to see if my ReceiveDate field is greater than 1/1/1991. If yes then I send an email:
Basic condition:
@greater(triggerBody()?['ReceiveDate'], '01/01/1991')
Advanced condition with coalesce function:
@greater(coalesce(triggerBody()?['ReceiveDate'],'01/01/1990'), '01/01/1991')