How to test for null/empty date?
Essentials 4.14
Workflow 5.22.2
I need to be able to test for a null/empty date. I have a date I know is null for a feature, but WF5 keeps treating it as if it’s not. I get the same result whether it’s a null date or a populated one.
My logic might not be quite correct, but I assume I should at least get different results for empty vs null dates. I should mention that my Javascript knowledge is very small, so I assume I'm missing something. Any help is much appreciated!
Null Date:

Populated Date:

Logic in the Create Value activity:

-
Hi Emily Renkema - A simpler method to check if a value is not null/empty is to use an if statement and set the condition to =!!$initialInspectionDate.value

The True side will indicate that there is a value while the False side will indicate that there is a null value.
I'm not entirely too sure what is contained within the $initialInspectionDate.value object, but it's possible that the "new Date()" method is actually never null and always returns the current date. Also depending on your requirements, there's a "Format Date" activity that you might be able to use.
Hope that helps!2 -
I think you're right about the new Date method. I've changed the code and it's returning as expected. I figured it was safe to assume I was missing something. :) Thanks!
0
Please sign in to leave a comment.
Comments
2 comments