I need to know if a certain field in the database is empty or not to create an email link with velocity scripting
#if ( ${lead.mkt3497link3} != "" )
#set ...
#end
Doesn't seem to work, although the field is empty it is selecting the if cause.
For debug reasons I have displayed the "content" of that empty field : the system displays "${lead.mkt3497link3}" as the value for the field. So the field is not evaluated, it seems...
What am I doing wrong and what is the correct way the check for empty fields.
It sounds like you didn't check the field off in the tree in Script Editor.
The way you're checking is OK for a string, though I recommend you switch to
#if ( $lead.mkt3497link3.isEmpty() )
to avoid surprises due to datatype mismatches. And also don't use ${formal} reference notation unless you're outputting something or are absolutely sure you need it, as it invites syntax errors.
Hi Franky,
Not sure if you found a solution yet. We were running into a similar velocity scripting problem and found a way to detect a null value:
#if(!${lead.insuranceExpirationDate})
<p>True </p>
#else
<p>False</p>
#end
Hope this helps!