Script showing something different in the preview than the test | Community
Skip to main content
Michael_McGowa1
Level 3
August 26, 2022
Solved

Script showing something different in the preview than the test

  • August 26, 2022
  • 1 reply
  • 4147 views

I have a script in an email that is adding the dollar amount of offers a person is eligible for and showing that in the subject line and the body. 

When I look at the email in the preview it is working as it should. Here is a screenshot.

However, when I send a test email, I am seeing the following.

What is happening?

Here is the script I am using.

##********Finding out if they came through the CoReg #set ($coReg = ${lead.mktocoreg}) #set ($coReg2Scp = ${lead.mktocoreg2scp}) #if($coReg.equals("niche")) #set ($coRegMkt = "yes") #elseif ($coReg.equals("campusreel")) #set ($coRegMkt = "yes") #else #set ($coRegMkt = "no") #end ##********Finding out if they came through the CoReg and converted or Just Member #if(($coReg2Scp.equals("")) && ($coRegMkt.equals("yes"))) #set ($scpMember = "Coreg Not a Member") #elseif (($coReg2Scp.equals("1")) && ($coRegMkt.equals("yes"))) #set ($scpMember = "Coreg but member") #else #set ($scpMember = "Member") #end ##******************Eligible or Taken Bold********** #set ($takenBold = ${lead.mktotakenBold}) #set ($eligibleBold = ${lead.mktoeligiblebold}) #if (($eligibleBold.equals("1")) && ($takenBold.equals(""))) #set ($showBold = 25000) #else #set ($showBold = 0) #end ##******************Eligible or Taken Niche********** #set ($takenNiche = ${lead.mktotakenNiche}) #set ($eligibleNiche = ${lead.mktoeligibleniche}) #if (($scpMember.equals("Coreg Not a Member")) && ($coReg.equals("niche"))) #set ($showNiche = 0) #elseif (($eligibleNiche.equals("")) && ($coReg.equals("campusreel")) && ($takenNiche.equals(""))) #set ($showNiche = 2000) #elseif (($eligibleNiche.equals("1")) && ($takenNiche.equals(""))) #set ($showNiche = 2000) #else #set ($showNiche = 0) #end ##******************Eligible or Taken Christian Connector********** #set ($takenCC = ${lead.mktotakenChristianConnector}) #set ($eligibleCC = ${lead.mktoeligiblechristianc}) #if (($eligibleCC.equals("1")) && ($takenCC.equals(""))) #set ($showCC = 2500) #else #set ($showCC = 0) #end ##******************Eligible or Taken Nitro********** #set ($takenNitro = ${lead.mktotakenNitro}) #set ($eligibleNitro = ${lead.mktoeligiblenitro}) #if (($eligibleNitro.equals("1")) && ($takenNitro.equals(""))) #set ($showNitro = 2000) #else #set ($showNitro = 0) #end ##Adding up the dollars available #set ($subtotal = $math.add($showNiche, $showBold, $showNitro, $showCC)) #set ($formattedTotal = $number.format("number", $subtotal)) $${formattedTotal}

 

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 SanfordWhiteman

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


You can check for either value:

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

1 reply

SanfordWhiteman
Level 10
August 26, 2022
Rule #1 with Velocity is that you don't use Send Sample to test, you use a real email!
Michael_McGowa1
Level 3
August 29, 2022

I sent a real email and this problems persists. Can you tell me what is causing this and how to fix it?

SanfordWhiteman
Level 10
August 29, 2022

Please include the output of a VTL token with just

${lead}

as well as the output of this VTL token. (Include both tokens in the same email.)