Velocity Script Token for Dynamic Content

Suchet-Randhawa
Level 1

Velocity Script Token for Dynamic Content

Hi, I can't figure out why my email script is not working:

 

Here is the situation:

A lead fills out a form for our upcoming user conference and can choose a combination of sessions that they would like to attend. The lead then receives an email response with dynamic content based on the sessions that they chose.

 

#if (${lead.intelliconSession1} == "1")
<p><strong> TEXT</strong></p>
#end

#if (${lead.intelliconSession2} == "1")
<p><strong>TEXT </strong></p>
#end

#if (${lead.intelliconSession3} == "1")
<p><strong>TEXT</strong></p>
#end

#if (${lead.intelliconSession4} == "1")
<p><strong>TEXT/strong></p>
#end

#if (${lead.intelliconSession5} == "1")
<p><strong>TEXT</strong></p>
#end

#if (${lead.intelliconSession6} == "1")
<p><strong>TEXT</strong></p>
#end

 

2 REPLIES 2
Disha_Goyal6
Level 4

Re: Velocity Script Token for Dynamic Content

Hi @Suchet-Randhawa,

 

Please check if this variables are checked in script-accessible objects.

 

Thanks,

Disha

 

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity Script Token for Dynamic Content

Remember to use the syntax highlighter when posting code (I edited your post this time).

 

“Not working” isn’t really enough to go on. We’d need to know the expected outcome and what you observe, and you haven’t established that the values you’re matching on (strings "1" and "0") are the real values of your fields. Disha is of course correct that if the fields aren’t checked off in Script Editor, nothing will work.

 

Even before having that additional info, there are some standard syntax corrections to make here. You shouldn’t be using the double-equals operator, and formal notation isn’t necessary:

#if ($lead.intelliconSession1.equals("1"))
<p><strong> TEXT</strong></p>
#end

#if ($lead.intelliconSession2.equals("1"))
<p><strong>TEXT </strong></p>
#end

#if ($lead.intelliconSession3.equals("1"))
<p><strong>TEXT</strong></p>
#end

#if ($lead.intelliconSession4.equals("1"))
<p><strong>TEXT/strong></p>
#end

#if ($lead.intelliconSession5.equals("1"))
<p><strong>TEXT</strong></p>
#end

#if ($lead.intelliconSession6.equals("1"))
<p><strong>TEXT</strong></p>
#end