Including tokens in a velocity script
Hi! I hope I'm asking this in the correct place.
I am running an email campaign where if a lead has an agent, a portion of the email (it's an entire section with images) saying "your agent is X and their details are Y" is displayed. But if a lead does not have an agent, I want to exclude that section entirely (rather than display an empty section with blank fields).
I have got as far as drafting the velocity script below, which uses an #if statement to check if the lead has an agent, and outputting that entire table section only if the lead's agent is not blank (we use W99999 to indicate that a client has not been assigned an agent yet). But the tokens e.g {{lead.Name of servicing agent:default=Financial Planning Manager’s Name}} in the bottom part of the code don't render properly - the recipients see the squiggly brackets and the text lead.Name of servicing agent:default=Financial Planning Manager’s Name instead of their agent's name.
May I please ask if anyone knows a way to have a velocity script which checks a field value, and includes tokenized values as part of the output? Thanks!
#if( ${lead.agent}!= "W99999")
<tbody>
<tr width="100%">
<td class="module">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr width="100%">
<td width="40" class=""> </td>
<td style="width: 560px">
<table border="0" cellpadding="0" cellspacing="0" class="column" style="padding: 0 49px 0 49px; display:table;" width="560">
<tbody>
<tr valign="top">
<td width="100%">
<table align="left" border="0" cellpadding="0" cellspacing="0" class="col-5" style="height:100%; display:table-cell;">
<tbody>
<tr valign="top">
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td valign="top" width="80"><img class="mktoImg" id="iconimg41bb4479-a6ca-403a-ace9-5efd779b3ecabf1270c5-1bdb-46d5-96a3-cafa6834b89b" align="top" src="https://asia.manulifeam.com/rs/819-VRX-399/images/callicon.png" width="50" style="width:50px; height:50px;" height="50" mktoname="Icon" mktolockimgsize="true" /></td>
<td valign="middle" style="font-family:arial; text-align:left; font-size:16px; line-height:26px; color:#282B3E;" class="mktEditable" id="iconmodtxt41bb4479-a6ca-403a-ace9-5efd779b3ecabf1270c5-1bdb-46d5-96a3-cafa6834b89b" mktoname="Icon Module Text">
<div style="color: #282b3e; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 11px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;
text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<div style="color: #282b3e; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 11px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;
text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<span style="color: #00a758; font-family: arial, helvetica, sans-serif; font-size: 16px;"><strong><span style="font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space:
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; float: none; display: inline !important;">Contact your Manulife Financial Planning Manager</span></strong></span>
</div>
<div style="color: #282b3e; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 11px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;
text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<span style="color: #282b3e; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">Want to learn more about our investment strategies? Please contact your Financial Planning Manager. </span>
</div>
<div style="color: #282b3e; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 11px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;
text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<span style="color: #282b3e; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"><span style="color: #282b3e; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">You can also click<span> </span></span><a href="https://www.manulifefunds.com.hk/en/investchoice/contact-us.html" target="_blank" style="font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space:
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;">here</a><span style="color: #282b3e; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space:
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"><span> </span>to contact with us.</span></span>
</div>
<div style="color: #282b3e; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 11px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;
text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<span style="font-size: 16px; font-family: arial, helvetica, sans-serif;"><strong style="color: #282b3e; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left;
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="color: #282b3e; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">Your Financial Planning Manager : {{lead.Name of servicing agent:default=Financial Planning Manager’s Name}}<br />T : {{lead.Phone of servicing agent:default=Mobile No}}<br />E : {{lead.Manulife Agent Email:default=Financial Planning Manager’s Email}}</span></strong></span>
</div>
</div> </td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</tbody>
</table> </td>
</tr>
</tbody>
</table> </td>
</tr>
</tbody>
</table> </td>
</tr>
</tbody>
</table> </td>
<td class="" style="width: 40px"> </td>
</tr>
</tbody>
</table> </td>
</tr>
</tbody>
#end