Hello everyone!
Has anyone successfully built a {{my.token}} which calls in a {{lead.token}}? I'm attempting to call in a User ID into a link within a {{my.token}}, and though I know this isn't technically supported, Sanford mentioned it's possible in this thread: Token in a Token?.
Is this for use inside email content or outside?
In an email you can use a Velocity {{my.token}} which of course has access to lead fields.
Using a token, I'm attempting to call in the email body based on the user's language, but neither the {{lead.user ID}} or the {{lead.First Name}} are populating for me. Is there something I'm missing with this approach? I do have another token which pulls in the {{lead.First Name}} to create a {{my.Clean First Name}} and that one does work.
Since you haven't posted your Velocity code, I can't really tell -- but you need to make sure the fields are checked off the right-hand side of Script Editor.
Here's my velocity code:
#if( $lead.browserLanguage.contains("de") )
#elseif( $lead.browserLanguage.contains("es") )
#elseif( $lead.browserLanguage.contains("fr") )
#elseif( $lead.browserLanguage.contains("nl") )
#elseif( $lead.browserLanguage.contains("pt") )
#elseif( $lead.browserLanguage.contains("ja") )
#else
<!-- 1 Column Text : DESKTOP : BEGIN -->
<tr>
<td>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tbody>
<tr>
<td style="padding: 50px 40px 0px 40px; text-align:left; font-family: sans-serif; font-size: 18px; mso-height-rule: exactly; line-height: 1.2; color: #444444;" class="mobile-text">
Hi {{lead.First Name:default=there}},
</td>
</tr>
<tr>
<td style="padding: 25px 40px 0px 40px; text-align:left; font-family: sans-serif; font-size: 18px; mso-height-rule: exactly; line-height: 1.2; color: #444444;" class="mobile-text">
<span style="font-weight: bold; color: #f78d20;">Welcome!</span> We know that your work revolves around process flows, value streams, and other diagrams—thank you for choosing Lucidchart. Our diagramming software can help you:
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- 1 Column Text : DESKTOP : END -->
<!-- Bulleted List :DESKTOP : BEGIN -->
<tr>
<td style="padding: 0px 40px 0px 40px; text-align:left; font-family: sans-serif; font-size: 18px; mso-height-rule: exactly; line-height: 1.2; color: #444444;" class="mobile-text">
<a style="text-decoration: none; color: #444444;">
<ul>
<li>Document and study “as-is” business processes</li>
<li>Show others your vision for new processes and gain buy-in from stakeholders</li>
<li>Increase productivity and save money by enforcing the standard</li>
<li>Meet compliance standards</li>
<li>Easily onboard new employees</li>
<li>Manage risk</li>
</ul>
</a>
</td>
</tr>
<!-- Bulleted List :DESKTOP : END -->
<!-- 1 Column Text : DESKTOP : BEGIN -->
<tr>
<td>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tbody>
<tr>
<td style="padding: 20px 40px 0px 40px; text-align:left; font-family: sans-serif; font-size: 18px; mso-height-rule: exactly; line-height: 1.2; color: #444444;" class="mobile-text">
Start your work and record your ideas right away by trying our <a class="mktNoTrack" href="https://www.lucidchart.com/pages/examples?kme=Clicked%20E-mail%20Link&kmi={{lead.Lucid User Id (L)}}&km_Link=FreeOperationsDay01">popular templates!</a>
</td>
</tr>
<tr>
<td style="padding: 45px 40px 0px 40px; text-align:left; font-family: sans-serif; font-size: 18px; mso-height-rule: exactly; line-height: 1.2; color: #444444;" class="mobile-text">
Click a template to try in the <a class="mktNoTrack" style="color: #f78d20;" href="https://www.lucidchart.com/documents?kme=Clicked%20E-mail%20Link&kmi={{lead.Lucid User Id (L)}}&km_Link=FreeOperationsDay01">Lucidchart editor</a>! We’ve made diagramming easier so you can make your work better.
</td>
</tr>
<tr>
<td style="padding: 35px 40px 0px 40px; text-align:left; font-family: sans-serif; font-size: 17px; mso-height-rule: exactly; line-height: 1.2; color: #444444; max-width: 600px; " class="image-mobile">
<img src="https://d2slcw3kip6qmk.cloudfront.net/marketing/emails/Marketo-Images/Orange-Line-Thin.png" width="600" style="width: 100%; max-width: 600px;" />
</td>
</tr>
<tr>
<td style="padding: 35px 40px 0px 40px; text-align:left; font-family: sans-serif; font-size: 18px; mso-height-rule: exactly; line-height: 1.2; color: #444444;" class="mobile-text">
Thanks!
</td>
</tr>
<tr>
<td style="padding: 25px 40px 0px 40px; text-align:left; font-family: sans-serif; font-size: 18px; mso-height-rule: exactly; line-height: 1.4; color: #444444;" class="mobile-text">
Mitchell, Customer Success <br>
<a class="mktNoTrack" href="https://www.lucidchart.com/documents?kme=Clicked%20E-mail%20Link&kmi={{lead.Lucid User Id (L)}}&km_Link=FreeOperationsDay01" style="color: #f78d20;">www.lucidchart.com</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- 1 Column Text : DESKTOP : END -->
<!-- 1 Column Text : DESKTOP : BEGIN -->
<tr>
<td>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tbody>
</tbody>
</table>
</td>
</tr>
<!-- 1 Column Text : DESKTOP : END -->
<!-- Social Icons : BEGIN -->
<tr>
<td align="center" valign="middle" width="100%" height="100%" style="padding: 30px 40px 20px 40px;" class="mobile-text">
<table align="left" style="Margin: auto;" class="">
<tbody>
<tr align="left">
<td style=" text-align:left; font-family: sans-serif; font-size: 14px; mso-height-rule: exactly; line-height: 1; color: #8e8e8e; visibility: hidden; display: none;" class="mobile-text-small show">
<p>Questions? We're happy to help!</p>
Email <a href="http://email.lucidchart.co/O040100Z0300qPbu0u0nd0T" style="color: #f78d20;">support@lucidchart.com</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- Social Icons : END -->
<!-- Social Icons : BEGIN -->
<tr>
<td align="center" valign="middle" width="100%" height="100%" style="padding: 10px 40px 40px 40px;" class="mobile-text">
<table align="left" style="Margin: auto;" class="">
<tbody>
<tr align="left">
<td style=" text-align:left; font-family: sans-serif; font-size: 14px; mso-height-rule: exactly; line-height: 1; color: #8e8e8e;" class="mobile-text hide" width="370">
<p>Questions? We're happy to help!</p>
Email <a href="http://email.lucidchart.co/O040100Z0300qPbu0u0nd0T" style="color: #f78d20;">support@lucidchart.com</a>
</td>
<td valign="middle" align="center" style="font-size:0px; line-height:0px;" width="30">
<a href="http://www.linkedin.com/company/lucidsoftware" target="blank" style="text-decoration:none;"><img src="https://d2slcw3kip6qmk.cloudfront.net/mailings/layouts/email-base-2017/linkedin_38x36.png" alt="fb" width="18" border="0" style="display:block;font-family:Arial, sans-serif; font-size:12px; line-height:20px; color:#ffffff;max-width:18px; text-decoration:none; padding-right: 30px;"></a>
</td>
<td valign="middle" align="center" style="font-size:0px; line-height:0px;" width="30">
<a href="http://twitter.com/lucidchart" target="blank" style="text-decoration:none;"><img src="https://d2slcw3kip6qmk.cloudfront.net/mailings/layouts/email-base-2017/twitter_39x32.png" alt="fb" width="19" border="0" style="display:block;font-family:Arial, sans-serif; font-size:12px; line-height:20px; color:#ffffff;max-width:19px; text-decoration:none; padding-right: 30px;"></a>
</td>
<td width="2" style="font-size:0px; line-height:0px;"> </td>
<td valign="middle" align="center" style="font-size:0px; line-height:0px;" width="30">
<a href="http://www.facebook.com/lucidchart" target="blank" style="text-decoration:none;"><img src="https://d2slcw3kip6qmk.cloudfront.net/mailings/layouts/email-base-2017/facebook_20x40.png" alt="tw" width="9" border="0" style="display:block;font-family:Arial, sans-serif; font-size:12px; line-height:20px; color:#ffffff;max-width:9px; text-decoration:none; padding-right: 30px;"></a>
</td>
<td width="2" style="font-size:0px; line-height:0px;"> </td>
<td valign="middle" align="center" style="font-size:0px; line-height:0px;" width="30">
<a href="http://www.youtube.com/user/lucidchart" target="blank" style="text-decoration:none;"><img src="https://d2slcw3kip6qmk.cloudfront.net/mailings/layouts/email-base-2017/youtube_42x32.png" alt="insta" width="20" border="0" style="display:block;font-family:Arial, sans-serif;max-width:20px; font-size:12px; line-height:20px; color:#ffffff; text-decoration:none; padding-right: 30px;"></a>
</td>
<td width="2" style="font-size:0px; line-height:0px;"> </td>
<td valign="middle" align="center" style="font-size:0px; line-height:0px;" width="30">
<a href="http://www.instagram.com/lucidchart" target="blank" style="text-decoration:none;"><img src="https://d2slcw3kip6qmk.cloudfront.net/mailings/layouts/email-base-2017/instagram_43x42.png" alt="insta" width="20" border="0" style="display:block;font-family:Arial, sans-serif;max-width:20px; font-size:12px; line-height:20px; color:#ffffff; text-decoration:none; padding-right: 10px;"></a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- Social Icons : END -->
#end
OK, let's slow down -- no need for the entire block of code when we're debugging output of one specific value!
You should be able to narrow the problem area down to a few lines of code with just the dynamic ${references} in it and concentrate only on that. Also, please use the Advanced Editor's syntax highlighter when posting code so it's readable:
Also, from what I can see so far, if $lead.browserLanguage is a String then contains() is a very fragile way to match values. Can the field truly have the (case-sensitive) characters "de" anywhere in it?
I think nested token functionality is not available yet. It's only calendar token which support other token inside.
As Sandy mentions, you can use lead tokens within email script tokens and therefore use this nested token approach in an email.