Skip to main content
Level 5
Apr 24, 2024 7:30 PM UTC
Solved

Custom Objects: isEmpty() and Date Fields?

Apologies if I am missing something glaringly obvious, but is there any sort of issue with date fields and the isEmpty() conditional? Running into an issue where a visually empty field on my end is returning a value as if there was data in the field? It's a Date field type and there's only one record - but for the below loop it's returing the #else value even though the field in the UI is blank.

#foreach ( $item in $digitalBankingProfileList ) #if ( $item.luminDigitalBankingLastLoginDate.isEmpty() ) This works correctly #else Script is broken #end #end

Is it actually a NULL value that's making it see it as not actually empty?

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SanfordWhiteman
SanfordWhitemanAccepted solution
User Group Leader
Apr 24, 2024 10:14 PM UTC

Correct. Actual null is not empty. While Person fields can't be null in Velocity, CO fields can.

 

If you want to check for empty or null, use the null coalesce method:

 

 

#if( $display.alt($someField,"").isEmpty() )

 

 

2 replies

SanfordWhiteman
User Group Leader
SanfordWhitemanUser Group LeaderAccepted solution
User Group Leader
Apr 24, 2024 10:14 PM UTC

Correct. Actual null is not empty. While Person fields can't be null in Velocity, CO fields can.

 

If you want to check for empty or null, use the null coalesce method:

 

 

#if( $display.alt($someField,"").isEmpty() )

 

 

Translate
Level 5
Apr 26, 2024 12:25 PM UTC

Thank you!!

Translate