Email script token using "if" not working | Community
Skip to main content
Jan 29, 2018 9:43 PM UTC
Solved

Email script token using "if" not working

I'm trying to display a extra line in an email if current customer is false and display nothing if current customer is true.

This is the script token I have setup:

#if(${lead.Current_Customer__c} == "False")<div style="font-family: Arial, sans-serif; font-size: 16px; color: #464646; line-height: 1.218em; margin-top: 5px;"><br /></div>

<div><span style="font-family: arial,helvetica,sans-serif; font-size: 14px;">MESSAGE<br /><br /></span></div>#end

In the email I have the token:

{{my.if prospect:default=NULL}}

I'm pretty sure I don't have this setup properly. So any help would be appreciated!

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
Level 10
Jan 29, 2018 10:02 PM UTC

Please use syntax highlighting when posting code (in the Advanced Editor):

#if(${lead.Current_Customer__c} == "False")<div style="font-family: Arial, sans-serif; font-size: 16px; color: #464646; line-height: 1.218em; margin-top: 5px;"><br /></div>

<div><span style="font-family: arial,helvetica,sans-serif; font-size: 14px;">MESSAGE<br /><br /></span></div>#end

If Current_Customer__c is a Boolean, you don't check for "False" (definitely not with a capital F!).

You check for the two string values "1" for true or "" (the empty string) for false.

Also, don't use the :default= clause with Velocity tokens, use #if #else #end in the Velocity code itself.

2 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Jan 29, 2018 10:02 PM UTC

Please use syntax highlighting when posting code (in the Advanced Editor):

#if(${lead.Current_Customer__c} == "False")<div style="font-family: Arial, sans-serif; font-size: 16px; color: #464646; line-height: 1.218em; margin-top: 5px;"><br /></div>

<div><span style="font-family: arial,helvetica,sans-serif; font-size: 14px;">MESSAGE<br /><br /></span></div>#end

If Current_Customer__c is a Boolean, you don't check for "False" (definitely not with a capital F!).

You check for the two string values "1" for true or "" (the empty string) for false.

Also, don't use the :default= clause with Velocity tokens, use #if #else #end in the Velocity code itself.

Translate
Jan 29, 2018 11:30 PM UTC

Sorry about that, first time poster. Thanks! That worked!

Translate