SOLVED

Using System Tokens in My Tokens

Go to solution
Highlighted
Level 1

Using System Tokens in My Tokens

Trying to render System Tokens in a My Token dynamic URL script. Is there a way to do this?

Code sample:

#if( $lead.flex1.contains("Target1"))  

<a href="https://www.sample.com?utm_campaign={{campaign.name}}&utm_source=Other-Email&utm_medium=email&utm_term={{Lead.Id}}&utm_content={{system.date}}%3A{{campaign.id}}&Emailrecepienttype={{lead.contact_type}}">Target Link 1</a>

#elseif( $lead.flex1.contains("Target2"))

<a href="https://www.marketo.com?utm_campaign={{campaign.name}}&utm_source=Other-Email&utm_medium=email&utm_term={{Lead.Id}}&utm_content={{system.date}}%3A{{campaign.id}}&Emailrecepienttype={{lead.contact_type}}">Target Link 2</a>

#end‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


Thanks!

#mytokens#velocity scripting#systemtoken#email reply #system token

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Level 1

Re: Using System Tokens in My Tokens

Thanks for the reply. Unfortunately, when rendered it throws the following error:

Cannot get email content- <div>An error occurred when procesing the email Rendered_Email_Velocity_Error_Area_unkown! </div> <p>Encountered "<EOF>" near</p> <div><pre ></pre><pre >${mktmail.Optout_text}</pre><pre class="x-form-item-label">@___MKTMAIL___@:END</pre></div>

View solution in original post

2 REPLIES 2
Highlighted
Level 10 - Community Moderator

Re: Using System Tokens in My Tokens

You don't need the {{system.date}} because Velocity has extremely robust datetime support of its own.

Contact Type is a Velocity-exposed field, too, so you don't need to get that as a {{lead.token}}.

Most of the campaign and program context can be obtained via this code: https://blog.teknkl.com/accessing-ab-test-variant-from-velocity/. However, the {{campaign.name}} is not exposed. Unfortunately, gettting at it is complex and I'd advise using another value.

Highlighted
Level 1

Re: Using System Tokens in My Tokens

Thanks for the reply. Unfortunately, when rendered it throws the following error:

Cannot get email content- <div>An error occurred when procesing the email Rendered_Email_Velocity_Error_Area_unkown! </div> <p>Encountered "<EOF>" near</p> <div><pre ></pre><pre >${mktmail.Optout_text}</pre><pre class="x-form-item-label">@___MKTMAIL___@:END</pre></div>

View solution in original post