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}
Solved! Go to Solution.
You can check for either value:
$value.isEmpty() || $value.equals("0")
I sent a real email and this problems persists. Can you tell me what is causing this and how to fix it?
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.)
I updated the code as you suggested but still having the problem. Here is the new code:
##********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 Juno**********
##set ($takenJuno = ${lead.mktotakenJuno})
##set ($eligibleJuno = ${lead.mktoeligiblejuno})
##if (($eligibleJuno.equals("1")) && ($takenJuno.equals("")))
##set ($showJuno = 2500)
##else
##set ($showJuno = 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}
In the body and subject line of the email, I have the token {{my.dollarAmt}}. The reason why I had two dollar signs in the output is because this is to show a dollar amount (i.e. $25,000). I'm at a loss of what to do and frustrated that when I look at the preview, the code is working as it should. It's when I send the email that it shows 0. What am I missing in the code so the correct number gets into the send email and is in a US currency format?
There’s not enough information here — like I said, need to see the raw output of the $lead and the output of your {{my.token}}, in the same email.
I am not sure what you mean. Do you need to see the code of the email where this appears? Here is that.
You qualify for these easy scholarships worth: {{my.dollarAmt}}
Here is the output that I am seeing:
Here is what I see in the preview:
Let me know if you need anything else.
Need to see the output of this Velocity token:
${lead}
Create a {{my.token}} with only that code. Include the token after your other token, in the same email. Then post the full output. Preferably in the text part of the email as it’ll be most readable.
Here is the output of the email after I sent it. This is being viewed in Outlook but also comes out this way in other ISPs like Gmail.
<!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;">
You qualify for these easy scholarships worth
0 this month:
</div>
<!--Controlled by template-->
</body>
</html>
I also noticed that when I view the email as a webpage, the token renders as it should. Here is the output from the View as Webpage.
<div class="mktoText" id="text">
Hey Michael,
<br>
You qualify for these easy scholarships worth
29,000 this month:
</div>
Hope this is what you are after. Let me know if you need anything else.
Where is the output of the second token supposed to be?