We are having an issue with email script tokens, we add an object value to the custom token and are finding that randomly that value won’t print / doesn’t have a value. This occurs without any changes made to the email script.
Some other time, the <h2>$clinics.Map.get($clinicID).OfficialName</h2> part of the token is treated just like ordinary string, and you see the code written bare on the email
#set($clinicID = ${lead.recentlyCreateClinicID})
The Clinic ID: ${lead.recentlyCreateClinicID}
<br>
The Clinic parsed: ${clinicID}
<br>
##if clinic id found
#if($clinics.Map.get($clinicID))
<h2>$clinics.Map.get($clinicID).OfficialName</h2>
#end
It has nothing to do with the global token thing we did, it’s just pulling from custom object.
When it is acting up, sending it to email will also show how it looks like on preview mode.
When it is not acting up , sending to email will also nice and proper email, without the weird code written bare
Any thoughts?
I doubt it's actually random. Velocity's behavior is to print source code if there's a handled exception. It only throws explicit errors w/error messages on unhandled exceptions. But both are error cases.
What is this $clinics.Map property? That nomenclature wouldn't be the usual way Marketo exports a CO list into Velocity. And if that reference is broken because the property Map doesn't exist you'll see just the source code. (Compare to what happens if $clinics.Map itself exists and is an array/list, but the indexed property $clinics.Map[<integer>] doesn't exist -- in contrast that's a hard error that will explicitly tell you there was a nonexistent index.)
Hi,
So the problem is that ${lead.recentlyCreateClinicID} will suddenly not have a value, we will have just this field printing on the page, and it will come up with nothing. We will work around a bit and then without a code change it comes back.
When this happens it causes the error where the token is printed to the screen.
$clinics is a global variable in JSON format. This is how we are pulling from a token with all our content. As long as ${lead.recentlyCreateClinicID} has a value everything works properly.
So the problem is that ${lead.recentlyCreateClinicID} will suddenly not have a value
Suddenly not have a value, or suddenly not be a key on the $lead object?
What does $lead.containsKey("recentlyCreateClinicID") print in these circumstances?
What does the lead token {{lead.Recently Create Clinic ID}} (use the real token name, of course) print if you include it in the same email (outside of Velocity, of course)?
Are you testing only using real emails (you can't use Samples to test Velocity)?
Hi,
We are using the preview mode and real leads / people on them. Most like it is that the key suddenly doesn't exist, so I will test $lead.containsKey("recentlyCreateClinicID").
When I am printing {{lead.Recently Create Clinic ID}}, it prints nothing at all when it "errors".
If I print as a token not through email script but directly in velocity it prints just fine.
It's really weird!
Use Preview by (static) List only.
I am using preview, preview by Person and then selecting a person.
Adam Bowles,
Director of Web Services, Partner
ACT 360 Web & I.T inc
act360.ca<http://www.act360.ca/>
Tel: 1 (705) 739 2281
Preview by List.
We are finding that if we preview in the browser it is working properly, when we send a test email most of our values work but one of them is not. For this one token it is printing the value instead of the token properly. Is this something that you get with preview by person or what could be going on here?
No code / token changes are being made.