SOLVED

How to reference Custom Objects in Velocity Script

Go to solution
Anonymous
Not applicable

How to reference Custom Objects in Velocity Script

Hi,

Trying to figure out how to use the velocity script with custom objects, while the documentation does work with Custom Objects, it is not clear how can I get the array of custom objects, (and their attributes) in a Velocity Script. Where can I find the name of the objects? I have tried doing a drag and drop, but nothing happens.
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: How to reference Custom Objects in Velocity Script

Use #set command like

#set ($EventList = <<drag the custom object from Right hand side here>>

Hope this helps.

Rajesh

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Re: How to reference Custom Objects in Velocity Script

I worked extensively on velocity scripts and marketo custom objects. The documentation at http://developers.marketo.com/documentation/email-scripting/
works for me.

I am not sure what do you mean by getting the array of custom objects. Does your business case needs to iterate throught all the records a lead have in the custom object associated with that lead? 
The name of the object is visible on the right hand side of the 'email script token' window. Make sure you 'check' each field you want to use in your script. If you do not, the script fails without throwing any error.

Please feel free to reach out if you need any pointers.

Rajesh Talele
 
Anonymous
Not applicable

Re: How to reference Custom Objects in Velocity Script

Thanks Rajesh,

Yes, kinda like the example we have in the link you referred, I want to iterate over all the custom objects a lead has, in the example you see this line:
#foreach( $event in $EventsList )
That means $EventsList is an Array containing all the events the lead has attended. How do I get that $EventsList? I have tried dragging the Event object (my custom object is named differently, but the principle is the same). Is there an initialization I am missing? Any help will be appreciated. Thanks again!
Anonymous
Not applicable

Re: How to reference Custom Objects in Velocity Script

Use #set command like

#set ($EventList = <<drag the custom object from Right hand side here>>

Hope this helps.

Rajesh

 
Anonymous
Not applicable

Re: How to reference Custom Objects in Velocity Script

Thanks Rajesh,

For some reason the drag and drop didn't work correctly in Chrome, I was working in Firefox and worked like a charm!
Anonymous
Not applicable

Re: How to reference Custom Objects in Velocity Script

Hi Rajesh, 

I have a related question. We have a custom object for a Lead's "Account Manager". That object has a handful of fields (email address, name, etc), but these are not available for us to "check"... I'm trying to reference these fields in an email we're building. To your knowledge, can we use Velocity to access these?

I understand that the documentation indicates you have to able to see/check the object, but in the "Helpful Hints" it also makes reference to being able to access "first and second level objects connected to Lead or Account" (below).

http://developers.marketo.com/documentation/email-scripting/
"You can reference first and second level custom objects that are directly connected to the Lead or Contact. However, you cannot reference third level objects or custom objects associated with the Account."

Thanks!
Anonymous
Not applicable

Re: How to reference Custom Objects in Velocity Script

Hi Jason,

Support for Account custom objects was introduced in Jan this year. So you should be able to use these fields in Marketo.

Can you confirm that the SFDC user used by Marketo for integration can indeed see this custom object?
May be Marketo does not have access to read this custom object in SFDC. I think most likely this might be an isse.

If that is fine, I think this will need some investigation. Marketo support would be able to help.

Hope this helps
 

Rajesh