SOLVED

Script showing something different in the preview than the test

Go to solution
Michael_McGowa1
Level 3

Re: Script showing something different in the preview than the test

It's one token. Just the dollar amount is the token because it is used in the subject line as well as the body of the email.

SanfordWhiteman
Level 10 - Community Moderator

Re: Script showing something different in the preview than the test

I’ve been asking that you create a 2nd token (see above) and add that {{my.token}} after your current one in the email. Not sure how that’s not coming across.

Michael_McGowa1
Level 3

Re: Script showing something different in the preview than the test

Below is the new output with the new token with $lead in the script.

You needed me to make a new script token with just $lead in the script. That was the disconnect.

I hope this is what you are after.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head> 
<body><div class="mc-ip-hide"><div style="color:#000000; font-size:12px; text-align:left; font-family:Helvetica, Arial, sans-serif;"><strong>CAUTION: External email. Please use caution when clicking links or opening attachments</strong><br></div><hr></div> 
<div id="body" class="mktoText" style="font-family: Helvetica, Arial, Sans-Serif; padding:10px;">
$0
<span style="color: #000000; font-family: Helvetica, Arial, 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: start; 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;">{mktoEmailable=1, mktotakenNiche=0, mktotakenJuno=0, mktoeligibleniche=1, mktocoreg=, mktotakenBold=0, mktotakenChristianConnector=0, mktoeligiblebold=1, mktoeligiblechristianc=0, mktoeligiblejuno=0, mktoeligiblenitro=1, mktocoreg2scp=0, mktotakenNitro=0}</span>
</div>  

<!--Controlled by template-->
</body>
</html>

 

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Script showing something different in the preview than the test

Think I see the problem.

 

Please add this to the second token and post the output:

#foreach( $entry in $lead.entrySet() )
${entry.getValue().class} ${entry.getKey()} ${entry.getValue()} 
#end

 

Michael_McGowa1
Level 3

Re: Script showing something different in the preview than the test

Added that code to the script. Here is the output from that.

<div class="mc-ip-hide"><div style="color:#000000; font-size:12px; text-align:left; font-family:Helvetica, Arial, sans-serif;"><strong>CAUTION: External email. Please use caution when clicking links or opening attachments</strong><br></div><hr></div> 
<div id="body" class="mktoText" style="font-family: Helvetica, Arial, Sans-Serif; padding:10px;">
$0
<span style="color: #000000; font-family: Helvetica, Arial, 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: start; 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;">{mktoEmailable=1, mktotakenNiche=0, mktotakenJuno=0, mktoeligibleniche=1, mktocoreg=, mktotakenBold=0, mktotakenChristianConnector=0, mktoeligiblebold=1, mktoeligiblechristianc=0, mktoeligiblejuno=0, mktoeligiblenitro=1, mktocoreg2scp=0, mktotakenNitro=0}
class java.lang.String mktoEmailable 1 
class java.lang.String mktotakenNiche 0 
class java.lang.String mktotakenJuno 0 
class java.lang.String mktoeligibleniche 1 
class java.lang.String mktocoreg  
class java.lang.String mktotakenBold 0 
class java.lang.String mktotakenChristianConnector 0 
class java.lang.String mktoeligiblebold 1 
class java.lang.String mktoeligiblechristianc 0 
class java.lang.String mktoeligiblejuno 0 
class java.lang.String mktoeligiblenitro 1 
class java.lang.String mktocoreg2scp 0 
class java.lang.String mktotakenNitro 0 
</span>
</div>
SanfordWhiteman
Level 10 - Community Moderator

Re: Script showing something different in the preview than the test

Everywhere you’re comparing to the empty string "" you should be comparing to "0".

Michael_McGowa1
Level 3

Re: Script showing something different in the preview than the test

I changed the code so I am comparing 0 instead of "" and seems to be working in the actual sends and test sends. The only issue is that if I look in the preview the token outputs $0 and if I view the email as a webpage it also shows $0. I can remove the view as webpage if needed but is there any way that it can be consistent? That the correct output be shown in the preview, sent email and viewed as a webpage? Otherwise, I'll call it resolved. Thank you for your help

SanfordWhiteman
Level 10 - Community Moderator

Re: Script showing something different in the preview than the test

You can check for either value:

$value.isEmpty() || $value.equals("0")