Email Scripting for Object Field Tokens

Anonymous
Not applicable

Email Scripting for Object Field Tokens

I have successfully sync'd our contract object to Marketo and I need to pull the field values associated into assets through tokens. The way I understand this is that only standard object (lead. company., etc.) field values will push into your normal MKTO tokens. For all other objects, like contracts, you'll need to create a email script token to pull the field values in as a token.

The example below is attempting to pull a field value from our contracts called "Contract Pin". The current script that I have does not seem to recognize the value / does not work when entered into an asset. The only example I can seem to find is this: Email Scripting » Marketo Developers​, which seems overly complicated. Any help is appreciated. Thanks!

pastedImage_2.png

pastedImage_1.png

1 REPLY 1
Anonymous
Not applicable

Re: Email Scripting for Object Field Tokens

When you are testing the email script token, you need to make sure you have a test record that has the object associated to it so you can tell if it's working or not. Also, you need to write up specific instructions about what you want to have displayed in the email. Right now, you're just dragging in the name of the object and telling Marketo to get the first of any Contract Pins associated to that person. You probably want to actually display specific fields from one or more specific objects and you will need to tell Marketo exactly what to do.

I know the developer example is a little complex when you're doing this for the first time. Take a look at this example instead and let me explain it:

<table border="1">

<tr>

<th>Item <th>Order ID</th><th>Date</th><th>Price</th>

</tr>

#foreach ( $SalesOrder5 in $SalesOrder5List )

<tr>

<td>

$SalesOrder5.Sales_Order5_Item

</td>

<td>

$SalesOrder5.Sales_Order5_ID

</td>

<td>

$SalesOrder5.Sales_Order5_Date

</td>

<td>

$SalesOrder5.Sales_Order5_Price

</td>

#end

What this script does is populate a table with information from a Sales Order custom object. In this case, I am going to show the full list of all sales orders with the Item, ID, Date, and Price. That's what the #foreach statement does. It says find the list of all Sales Order objects associated to this person and for every single one of them, create a new row in the table that populates data in each cell. Then within each of the four cells, I am pulling four fields of information into the cells. The $SalesOrder5 tells Marketo which object to pull the field from and the Sales_Order5_ID is the specific field we want to populate in the email.