Hey there,
This is my first try at Velocity scripting so don't laugh if I've made a simple error but just can't see it.
Ok so the situation is that we will have a 'faux booking' form on a website. The lead can select how many passengers there will be, up to 6. And enters their details
Depending on what value they put in for 'how many passengers do you have?', different text shows in an alert email to a sales consultant. If they select 3 adults, then the details of those 3 passengers will show in the alert email. If 6, then 6.
This is what I would like to appear: (note: passenger 1 is the actual lead's record, so not included in the scripting)
Passenger 2
Name: Bob Smith
Date of Birth: 25/02/1990
Passenger 3
Name: Kelly Jones
Date of Birth: 01/08/1965
Passenger 4
Name: Mark Jones
Date of Birth: 30/09/1970
Passenger 5
Name: Terry Adams
Date of Birth: 22/04/1980
Passenger 6
Name: Mark Adams
Date of Birth: 14/08/1996
However, this is what is appearing when I do a real (and sample) send:
Passenger 2
Name: Bob Smith
Date of Birth: 25/02/1990
Passenger 3
Name: ${lead.mktoFirstname2} ${lead.mktoLastname2}
Date of Birth: ${lead.mktoDOB2}
Passenger 4
Name: ${lead.mktoFirstname3} ${lead.mktoLastname3}
Date of Birth: ${lead.mktoDOB3}
Passenger 5
Name: ${lead.mktoFirstname4} ${lead.mktoLastname4}
Date of Birth: ${lead.mktoDOB4}
Passenger 6
Name: ${lead.mktoFirstname5} ${lead.mktoLastname5}
Date of Birth: ${lead.mktoDOB5}
Here is the email script for if the Passengers=6
#if(${lead.mktoPassengers1}==6)
Passenger 2 <br/>
Name: ${lead.mktoFirstname1} ${lead.mktoLastname1} <br/>
Date of Birth: ${lead.mktoDOB1} <br/>
<br/>
Passenger 3 <br/>
Name: ${lead.mktoFirstname2} ${lead.mktoLastname2} <br/>
Date of Birth: ${lead.mktoDOB2} <br/>
<br/>
Passenger 4 <br/>
Name: ${lead.mktoFirstname3} ${lead.mktoLastname3} <br/>
Date of Birth: ${lead.mktoDOB3} <br/>
<br/>
Passenger 5 <br/>
Name: ${lead.mktoFirstname4} ${lead.mktoLastname4} <br/>
Date of Birth: ${lead.mktoDOB4} <br/>
<br/>
Passenger 6 <br/>
Name: ${lead.mktoFirstname5} ${lead.mktoLastname5} <br/>
Date of Birth: ${lead.mktoDOB5} <br/>
#end
Can anyone help me? Any explanations/ suggestions as to why aren't the lead. tokens pulling in the data would be AWESOME!
I have double checked and the fields are named correctly and the test lead I'm using has data in the fields.
Thanks!
Katie
Solved! Go to Solution.
First, ensure that all of those fields are checked off in the tree on the right-hand side of the Script Editor window. Otherwise they won't be exported into Velocity (i.e. able to be referenced in scripts).
Hey Sanford, So simple. THANKS!!!!
I had copied and pasted the lead tokens and changed the trailing number. They weren't ticked on the right hand side.
Great! By the way, fields need to be ticked off instead of including them all by default because as the "width" of a lead object (the aggregate stringified length of all lead fields added together) grows, the resulting Java object that would need to be exported into Velocity could get very large. And even converting other datatypes to Strings comes with overhead as well. So it's best to export only the ones you know you need.
One doesn't often worry about the size of Java objects (the assumption being that if properties are necessary for an app, you might as well pass them around), but with the massive scale of Marketo sends it's smart to be conservative.