Anybody Using Apache Velocity Code?

Riz_Alvi
Level 4

Anybody Using Apache Velocity Code?

Hi,

We are exploring using Apache Velocity code for writing certain fields to contact/lead objects. Also, exploring what else is possible with Apache Velocity code that we can use for analytics.....Like marking MQL Date/Time 1, MQL Date/Time 2....etc. 

Appreciate a response.

Thanks!

Riz

 

Riz Alvi
6 REPLIES 6
Jo_Pitts1
Level 8

Re: Anybody Using Apache Velocity Code?

@Riz_Alvi ,

you wouldn't use Velocity to write back to objects of any type.  It is an scripting language used at output time which in a Marketo context fundamentally means it is used in emails or landing pages.

 

Typically (internally to Marketo), you'd use smart campaigns to update data, or you'd use API calls to do it externally.  I'd have thought this would suffice for setting MQL Date/Time based on certain other attributes being populated.

 

What are your actual use cases?  Then maybe the community can come up with a more informed set of suggestions.

 

Cheers

Jo

SanfordWhiteman
Level 10 - Community Moderator

Re: Anybody Using Apache Velocity Code?


you wouldn't use Velocity to write back to objects of any type.  It is an scripting language used at output time which in a Marketo context fundamentally means it is used in emails or landing pages.

Only emails actually. 🙂

 

Jo_Pitts1
Level 8

Re: Anybody Using Apache Velocity Code?

Ah yes.. quite so.. My bad!

Still... the core point (which you succintly re-iterated and expanded on) holds 🙂

Thanks for the correction.. goodness knows why my brain suddenly decided you could do velocity on Landing Pages 🙂

SanfordWhiteman
Level 10 - Community Moderator

Re: Anybody Using Apache Velocity Code?

But yes, Velocity does not permanently alter any values. Its work is confined to the email assembly process, and even if you change a $lead field value within Velocity (which might appear to be possible at first glance) that’s not writing to the actual lead record, only changing the copy of the lead values that’s injected into the Velocity context. The database is not affected.

 

As far as applications for Velocity, they are unlimited. A search of my Products blog posts and past Community threads just gives a glimpse.

Tracy_Boesken
Level 3

Re: Anybody Using Apache Velocity Code?

@SanfordWhiteman Can Velocity code be used to retrieve Program Name (not Program ID) from an operational/global level?

For example: I want to write to custom fields MQL 1 Program Name, MQL 2 Program Name, MQL 3 Program Name, MQL 4 Program Name, MQL 5 Program Name (as well as SAL, SQL, and OPP) by creating a triggered campaign listening for Data Value Changes to MQL, SAL, SQL, and OPP.

I currently am able to write the custom dateTime value stamp fields on a global level with {{system.dateTime}}. I want to also pull the Program Name that triggered the change.

 

Thanks,

--Tracy

SanfordWhiteman
Level 10 - Community Moderator

Re: Anybody Using Apache Velocity Code?

Velocity can‘t be used in Flow steps (which it sounds like you mean).

 

But that’s not so much the problem anyway — the problem is if a Smart Campaign is (a) global and (b) doesn‘t trigger on a Program Status or other Program-level activity, it doesn’t have a Program context. When you have a global SC with a Program-related trigger, you can use {{trigger.name}} to get the Program Name.