Using System Tokens in My Tokens | Community
Skip to main content
Caleb_Kelly
Level 2
June 21, 2019
Solved

Using System Tokens in My Tokens

  • June 21, 2019
  • 1 reply
  • 3018 views

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

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

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>

1 reply

SanfordWhiteman
Level 10
June 21, 2019

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.

Caleb_Kelly
Caleb_KellyAuthorAccepted solution
Level 2
August 20, 2019

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>