Re: Velocity script doesn't work

Igor_Khripunov
Level 4

Velocity script doesn't work

Hello everyone!
I'm trying to use the Velocity template language in Marketo.
For example, I want to get all the people who live in Boston.

This is my simple Velocity script:

0EM50000000R1qc.jpg

When I send a test message, then comes a blank message.

Who knows what's wrong?

Source:

#set ( $myLeadList = $complex.Objects.get("Lead") )
#foreach( $myResult in $myLeadList )
#if ( $myResult.City == "Boston" ) 
   <b>$myResult.Full_Name</b> lives in Boston <br />
 #end
#end


Tags (1)
5 REPLIES 5
Anonymous
Not applicable

Re: Velocity script doesn't work

Make sure the box is checked on the City attribute under the Standard Object->Lead object that you are referencing in your script.  Without the checkbox on the intended attribute, the values for a given object (like Lead.City) won't be able to be referenced.
Igor_Khripunov
Level 4

Re: Velocity script doesn't work

Travis, thank you for answer!
 
Yes, City and Full name are checked.

0EM50000000R1zp.jpg
Anonymous
Not applicable

Re: Velocity script doesn't work

Did you ever figure this out?

I don't think that the full lead list is available to pass into a local variable to use/parse in a Velocity script.  If I understand what you're trying to do correctly, I think you're trying to access your entire lead database and output the names of the leads that are located in Boston?

In the context of generating an email to go to a lead, the field values associated with that specific lead are available as well as any objects that have records associated with that lead.

That said, I think there's a real need for more documentation from Marketo on how to reference the Marketo database in Velocity scripts.  If you (or anyone else reading this discussion) agree, could you "like" the following idea I just submitted?

https://community.marketo.com/MarketoIdeaDetail?id=08750000000JYPuAAO

Thanks,
-patrick
Anonymous
Not applicable

Re: Velocity script doesn't work

I need to second this question from Patrick, I have the same issue with an e-mail script of mine (the output of the e-mail token stays 'empty').

Has there been any solution to this?

SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity script doesn't work

Please open a new thread instead of posting on this 3-year-old one and I'll answer there.  I'll also need to see your VTL code to see what you're doing.