Token Email Script Works/Doesn't Work Same Email

Highlighted

Token Email Script Works/Doesn't Work Same Email

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!

6 REPLIES 6
Highlighted
Level 10 - Community Moderator

Re: Token Email Script Works/Doesn't Work Same Email

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"?

Re: Token Email Script Works/Doesn't Work Same Email

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.

Highlighted
Level 10 - Community Moderator

Re: Token Email Script Works/Doesn't Work Same Email

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

Highlighted

Re: Token Email Script Works/Doesn't Work Same Email

##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
Highlighted
Level 10 - Community Moderator

Re: Token Email Script Works/Doesn't Work Same Email

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.

Highlighted

Re: Token Email Script Works/Doesn't Work Same Email

That worked perfectly. Thanks Sanford!