Attention: The Marketo Community will undergo scheduled maintenance on Tuesday, August 20th between 10-11 PM PDT. During this time, the Community and its content will not be accessible. We apologize for any inconvenience this may cause.
We are trying to come up with a Velocity Script to display all records from a Custom Object.
We have Subscribers (leads) with 1, 2, 3 or more Beneficiaries in a Custom Object. Our email message should look like this:
Dear <Subscriber Name> .
Here is the info about your Beneficiaries:
Beneficiary 1 Name
Beneficiary 1 Plan #
Beneficiary 2 Name
Beneficiary 2 Plan #
Beneficiary 3 Name
Beneficiary 3 Plan #
I tried to use the following script for this:
${beneficiary_cList.get(0).beneficiaryFirstName}
${beneficiary_cList.get(0).beneficiaryPlanNumber}
${beneficiary_cList.get(1).beneficiaryFirstName}
${beneficiary_cList.get(1).beneficiaryPlanNumber}
${beneficiary_cList.get(2).beneficiaryFirstName}
${beneficiary_cList.get(2).beneficiaryPlanNumber}
However, if a Subscriber has less than 3 records in a Beneficiary Custom Object, this script would return an error and the email won't be delivered.
Is there another solution for this?
Solved! Go to Solution.
HI Olga,
You will have to loop through the list instead, using a "#foreach($event in $ObjectList)" instruction. ALso, remember that every custom object has a list attached to it, with the name of <objectName>List.
Look at http://developers.marketo.com/email-scripting/examples/ for a code example.
Please not that Marketo will not retrieve more than 10 custom objects for each lead, though.
-Greg
HI Olga,
You will have to loop through the list instead, using a "#foreach($event in $ObjectList)" instruction. ALso, remember that every custom object has a list attached to it, with the name of <objectName>List.
Look at http://developers.marketo.com/email-scripting/examples/ for a code example.
Please not that Marketo will not retrieve more than 10 custom objects for each lead, though.
-Greg
Thanks, Greg!
You are always very helpful and super quick with response!
You are welcome