Re: Email Script will not display value in link

Anonymous
Not applicable

Email Script will not display value in link

Greetings,

I have the following simple logic for an email script {{my.cOwner}}

#set($CO = "")

#if(${lead.ContactOwner} == "Ed Rayyis")

#set($CO = "&contactSegment=data")

#end

${CO}

in my email HTML I have the following link:

<a href=http://www.rayyis.com?utm_medium=email&utm_campaign={{my.utm_campaign}}{{my.cOwner}}" target="_blank">

problem is the logic works but values do not get passed in the link. if I simply add {{my.cOwner}} token in my email anywhere I see all values populate correct, if I click the link, all values are displayed in the link except for the scripted {{my.cOwner}} part. If on the other hand I click view email in browser, the link displays correctly with the correct value based on the logic. Any one came across such a problem and found a fix or work around?

Tags (2)
7 REPLIES 7
SanfordWhiteman
Level 10 - Community Moderator

Re: Email Script will not display value in link

You should be outputting the entire, fully-formed <a> tag from Velocity.  This is one of a few restrictions that are specific to Marketo's Velocity flavor (they're not restrictions in the Velocity language in general).

Also, pls try to use the syntax highlighter (in the Advanced Editor)...

pastedImage_2.png

Anonymous
Not applicable

Re: Email Script will not display value in link

I tried to enter it as code, but for some reason it was getting messed up, and in white text, and figured the script was so short, it was ok.

The reason why I did not output the <a> tag in VScript is because the link has manual inputted tokens included that users change values to based on link type on a campaign level, and you cannot include these {{my.tokens}} in the Email Script. Plus the link is not always the same, and the tagging is dependant on values coming from campaign level tokens as well as CRM/Marketo lead tokens.

SanfordWhiteman
Level 10 - Community Moderator

Re: Email Script will not display value in link

You have to output the <a> tag from Velocity, no other way around it.

...the link has manual inputted tokens included that users change values to based on link type

on a campaign level, and you cannot include these {{my.tokens}} in the Email Script.

You can if those other {{my.tokens}} are also Velocity tokens that set Velocity variable names.

{{my.token1}}

#set( $userControlledVariable1 = "value" )

{{my.token2}}

<a href="https://www.example.com/?value=${userControlledVariable}>Click me</a>

The email contains

{{my.token1}}

{{my.token2}}

Nicholas_Manojl
Level 9

Re: Email Script will not display value in link

What's the actual script?

SanfordWhiteman
Level 10 - Community Moderator

Re: Email Script will not display value in link

(I think Ed's script is the short one above. Problem is he's not outputting the full link.)

alec_haase
Level 2

Re: Email Script will not display value in link

Hello all- was a different solution ever found? Having the same issue with inputting a unique barcode into a link to prefill into a cart once on site

SanfordWhiteman
Level 10 - Community Moderator

Re: Email Script will not display value in link

If the barcode is "unique" to the lead, then it's a lead field, which can always be accessed directly from Velocity.

Perhaps if you explain your case more you can show how it relates to the question of Velocity-exposed fields/tokens.