So I'm trying to script a token based on a custom object... most importantly I want it to display text field 2 if someone has that custom object on their record.
I see this option in the coding, but am not sure how to tell Marketo which list to reference to display the text2 field.
${customList_cList.get(0).text2}
I think this should be relatively simple, but am not having any luck with it so I figured I would reach out.
Thanks in advance.
Solved! Go to Solution.
That code is outputting the text2 property of the 0th (i.e. first) item in the ArrayList of customList objects, in what you should consider an arbitrary sort order.
What is the “correct” customList object?
Please highlight your code using the Advanced Editor’s syntax highlighter (you can choose Java as the language as it’s closest to Velocity). Then we’ll continue.
This is new to me, so let me know if I get it right.
${customList_cList.get(0).text2}
I need to know how to identify which list Marketo is referencing to get the correct text2 content to display.
Thanks.
We have custom list object for people who have had a card returned and it that List ID is called Returned Card Notice
Please output the entire $customList_cList so I can see the Velocity property names for those fields.
Make sure the fields are checked off in the tree on the right-hand side of Script Editor.
I'm not sure I know how to do that. Is there some documentation you could point me to? I'm still very much a Marketo rookie and am noticing we are missing out on things by not utilizing scripting tokens, but I'm at the early stages of investigating what it would take to implement.
I truly appreciate your help and patience.
Okay. I think I figured out.
Please let me know if this sounds right:
${customList_cList.get(2).text2}
and the (2) is referencing the specific Custom Object list and displaying the text 2 field.
Thanks for your help Sanford.
No, arbitrarily choosing the 3rd object in the list, a list that should not be considered to be in any particular business order by default, is certainly not the solution.
I didn't arbitrarily choose the 3rd object.
I went to admin - Database management - Marketo Custom Objects - used by and only one of them (the card return object) uses the Text2 field. and that one is the 3rd object on that list with a ListID. so that is why I selected the 3rd object and am seeing the results that line up with that list object.
Does this past muster or is there something else I should check it against or another way to see which list it should reference?