AnsweredAssumed Answered

Velocity Script tokens behave unexpectedly

Question asked by Roger Morris on Apr 5, 2018
Latest reply on Apr 5, 2018 by Sanford Whiteman

I am trying to insert script tokens into an email template.

The ZillowOpen script is:

#set($zHideOpen = "")
##check if the field is null
#if(${lead.zillow}.isEmpty())
#set($zHideOpen = "<!--")
#end
${zHideOpen}

And ZillowClose:

#set($zHideClose = "")
##check if the field is null
#if(${lead.zillow}.isEmpty())
#set($zHideClose = "-->")
#end
${zHideClose}

This intent is to comment out HTML if the link isn't available.

However, the results are:

Screen Shot 2018-04-05 at 2.57.34 PM.png

Which is strange because the token is appearing in the email above the table and it's below in the HTML. This didn't help either. https://nation.marketo.com/message/180834-re-token-wont-populate-keeps-appearing-as-text#comment-180834

</table>{{my.ZillowOpen}}
                                    <table mktoName="mkto" class="mktoModule" id="Features3Colf6c43dde-6ec2-4b72-87f8-4a2c67c6e77a9c2fbeb5-a151-4aff-a4c1-9a263dc62f65949d6569-c90f-4f14-a99d-273eb8da091f" style="-webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-spacing: 0; border-collapse: collapse;" align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tbody>
                                            <tr>
                                                <td valign="top" bgcolor="#FFFFFF">
                                                    <table class="inner_table" width="600" align="center" cellpadding="0" cellspacing="0" style="width:600px; margin: 0 auto; border-collapse: collapse;">
                                                        <!--Extra space-->
                                                        <tbody>
                                                            <tr>
                                                                <td height="20" colspan="5" style="line-height: 1px; font-size: 1px;"> </td>
                                                            </tr>
                                                            <tr>
                                                             <td class="block" valign="top" width="190">
                                                                    <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%" style="width: 100%; border-collapse: collapse;">
                                                                        <tbody>
                                                                            <tr>
                                                                                <!--image-width:125px;height:125px-->
                                                                                <td class="padding_top" style="text-align:center;" valign="top">
                                                                                    <div mktoName="mkto" id="Features3ColRImgf6c43dde-6ec2-4b72-87f8-4a2c67c6e77a6c4094f2-8082-4a1e-aea7-b65cce461f2c" class="mktoImg" mktolockimgsize="true">
                                                                                        <a href="http://{{lead.zillow}}" target="_blank"><img src="http://XXX.marketo.com/rs/XXX/images/zillow.jpg" width="125" style="" /></a>
                                                                                    </div>
                                                                                </td>
                                                                            </tr>
                                                                            <!--Extra space-->
                                                                            <tr>
                                                                                <td height="20" style="line-height: 1px; font-size: 1px;"> </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td valign="top">
                                                                                    <table cellpadding="0" cellspacing="0" border="0" width="100%" style="width: 100%; border-collapse: collapse;">
                                                                                        <tbody>
                                                                                            <tr>
                                                                                                <td valign="top" style="font-size:14px; color:#000000; font-family:Arial,Helvetica,sans-serif; mso-line-height-rule: exactly; line-height:20px;text-align:center;">
                                                                                                    <div mktoName="mkto" class="mktoText" id="Features3ColRDescf6c43dde-6ec2-4b72-87f8-4a2c67c6e77a6c4094f2-8082-4a1e-aea7-b65cce461f2c">
                                                                                                        <p><span style="color: #222222; font-family: Roboto, arial, sans-serif; font-size: 13px; 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-style: initial; text-decoration-color: initial; display: inline !important; float: none;" mce-data-marked="1"><strong>
  <a href="http://{{lead.zillow}}" target="_blank">Zillow</a>
</strong></span><span style="color: #222222; font-family: Roboto, arial, sans-serif; font-size: 13px; 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-style: initial; text-decoration-color: initial; display: inline !important; float: none;"> is a real estate and rental marketplace dedicated to empowering consumers with data, inspiration, and knowledge.</span>
                                                                                                            <br />
                                                                                                        </p>
                                                                                                    </div>
                                                                                                </td>
                                                                                            </tr>
                                                                                        </tbody>
                                                                                    </table>
                                                                                </td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table>
                                                                </td>{{my.ZillowClose}}

Outcomes