Re: Getting started with Velocity scripting

Phillip_Wild
Level 10 - Community Advisor

Re: Getting started with Velocity scripting

Perfect. Thanks!

Nicholas_Manojl
Level 9

Re: Getting started with Velocity scripting

Phillip - it helps if you start with a problem that needs solving.

For example, have your team figure out how to script up some text to display if they have a particular product versus another. Give them time for trial and error. Have them post on the community if they can't figure it out.

Use as much of the built in tools you can - for example, drag and drop a field name from the velocity editor into the textarea. It will take care of the formal notation for you.

Trust me, it's easier than you'd think once you allow your eyes to see past the curly braces and dollar signs.

Anonymous
Not applicable

Re: Getting started with Velocity scripting

Hi All,

I am definatly the type of person that learns form examples, it would be great if people share some great recepies, this demonstrates how it is done and also gives insitght into what is possible.

SanfordWhiteman
Level 10 - Community Moderator

Re: Getting started with Velocity scripting

Here's one from today:

Tokens and importing complex data

But I try not to overstate the ease of becoming truly fluent in Velocity. To do advanced Velocity, or to really understand what's going on in intermediate stuff like the example above, you need to grok Java objects, which is more than just "scripting."  (Velocity was designed as a somewhat cut-down Java VM, but still expected to be used primarily by Java developers, albeit junior ones. Think of it like a Java sandbox as opposed to a scripting language.)

Anonymous
Not applicable

Re: Getting started with Velocity scripting

Thanks Sanford,

If I have a score field and I want to display different text depending on a range how would I modify the below expression:

#if (${lead.example} == "> 500 : < 600") 

Text here

#end

BTW I made that up as an example

SanfordWhiteman
Level 10 - Community Moderator

Re: Getting started with Velocity scripting

Open a new thread and I'll tell ya.