Token Email Script Works/Doesn't Work Same Email | Community
Skip to main content
Marc_Comption
Level 2
August 22, 2019
Question

Token Email Script Works/Doesn't Work Same Email

  • August 22, 2019
  • 3 replies
  • 3487 views

I have several tokens in an email that uses email script. The Marketo field that calls it is the same across all the tokens. When I click through the links for the specific iteration {lead.dsSiteID} == "979" about half the time it returns the right value in the email, half it returns the default value. All other iterations like {lead.dSSiteID} == "154" return the right value. Has anyone else ever run into this before? 

Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

SanfordWhiteman
Level 10
August 22, 2019

The notation you're using, single curly braces, isn't valid in Velocity (ever). Is this really an Email Script (Velocity) token? What do you mean by "iteration"?

Marc_Comption
Level 2
August 22, 2019

Here's the script as currently written:

##check assigned store and return the Schedule Test Drive URL
#if(${lead.dSSiteID} == "3670")
    #set($ScheduleTestDrive = "www.bigstarhonda.com/schedule-test-drive/")
#elseif(${lead.dSSiteID} == "2945")
    #set($ScheduleTestDrive = "www.texandodgechryslerjeepram.com/schedule-test-drive/")
#elseif(${lead.dSSiteID} == "2289")
    #set($ScheduleTestDrive = "www.hamertoyota.com/schedule-test-drive/")
#elseif(${lead.dSSiteID} == "7305")
    #set($ScheduleTestDrive = "www.westcoasttoyotalb.com/schedule-test-drive/")
#elseif(${lead.dsSiteID} == "979")
    #set($ScheduleTestDrive = "www.stadiumnissanoc.com/schedule-test-drive/")
#elseif(${lead.dSSiteID} == "154")
    #set($ScheduleTestDrive = "www.kengarffhondadowntown.com/schedule-test-drive/")
#elseif(${lead.dSSiteID} == "110")
    #set($ScheduleTestDrive = "www.dodgehq.com/finance/schedule-test-drive/")
#elseif(${lead.dSSiteID} == "5342")
    #set($ScheduleTestDrive = "www.telegraphchryslerdodgejeepram.com/schedule-test-drive/")
#else
    #set($ScheduleTestDrive = "www.kengarff.com/schedule-test-drive/")
#end
$ScheduleTestDrive

The possible locations are the SiteID. These 8 are the only possible variations that could be in that field currently.

SanfordWhiteman
Level 10
August 22, 2019

Please highlight the code (as Java, closest thing to Velocity) using the Advanced Editor's syntax highlighter. Then we'll continue.

Marc_Comption
Level 2
August 22, 2019
##check assigned store and return the Schedule Test Drive URL
#if(${lead.dSSiteID} == "3670")
#set($ScheduleTestDrive = "www.bigstarhonda.com/schedule-test-drive/")
#elseif(${lead.dSSiteID} == "2945")
#set($ScheduleTestDrive = "www.texandodgechryslerjeepram.com/schedule-test-drive/")
#elseif(${lead.dSSiteID} == "2289")
#set($ScheduleTestDrive = "www.hamertoyota.com/schedule-test-drive/")
#elseif(${lead.dSSiteID} == "7305")
#set($ScheduleTestDrive = "www.westcoasttoyotalb.com/schedule-test-drive/")
#elseif(${lead.dsSiteID} == "979")
#set($ScheduleTestDrive = "www.stadiumnissanoc.com/schedule-test-drive/")
#elseif(${lead.dSSiteID} == "154")
#set($ScheduleTestDrive = "www.kengarffhondadowntown.com/schedule-test-drive/")
#elseif(${lead.dSSiteID} == "110")
#set($ScheduleTestDrive = "www.dodgehq.com/finance/schedule-test-drive/")
#elseif(${lead.dSSiteID} == "5342")
#set($ScheduleTestDrive = "www.telegraphchryslerdodgejeepram.com/schedule-test-drive/")
#else
#set($ScheduleTestDrive = "www.kengarff.com/schedule-test-drive/")
#end
$ScheduleTestDrive
SanfordWhiteman
Level 10
August 22, 2019

The property can only be spelled one way, and it is case-sensitive.  So unless you're trying to check 2 different fields, this doesn't make sense.

You can remove the curly braces, they're not necessary.

Marc_Comption
Level 2
August 22, 2019

That worked perfectly. Thanks Sanford!