SOLVED

Custom Objects: isEmpty() and Date Fields?

Go to solution
nhabischWings
Level 5

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?

 

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Custom Objects: isEmpty() and Date Fields?

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() )

 

 

View solution in original post

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Custom Objects: isEmpty() and Date Fields?

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() )

 

 

nhabischWings
Level 5

Re: Custom Objects: isEmpty() and Date Fields?

Thank you!!