Token is empty mean need to hide entire row in my email | Community
Skip to main content
Level 1
October 18, 2024
Solved

Token is empty mean need to hide entire row in my email

  • October 18, 2024
  • 2 replies
  • 1759 views

In my email when the token value is empty or blank, I want to hide a section in my HTML email.

could you please help me with how to achieve this?

 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman
What language is interpreting the ternary operator in Method 2? Please test this on your side.

2 replies

SanfordWhiteman
Level 10
October 18, 2024

Well, “empty” and “blank” are the same thing. You probably meant null which is technically different in the database.

 

When you say “token”, do you actually mean the value of a Person field? Tokens — for example {{lead.tokens}} — are one way to output database values, but you should think in terms of the database itself. It’s confusing to talk about a token being empty because tokens can output default values even if the database field is empty.

 

 

 

Level 2
October 22, 2024

Hi @muniyandi  If you're comfortable using Velocity Scripting (available in Marketo Email Script tokens), you can conditionally display content based on token values.

 

Example with first Name

#set( $firstName = ${lead.FirstName} ) #if( !$firstName || $firstName.trim() == "" ) ## Do nothing (the section will be hidden) #else <div> <p>Hello $firstName,</p> </div> #end

 

 

Thanks

 

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
October 22, 2024
What language is interpreting the ternary operator in Method 2? Please test this on your side.