Re: Reference Lead.Id in Velocity

Peter_Liske4
Level 1

Reference Lead.Id in Velocity

In the list of fields on the right side of the velocity script editor, it appears the Lead ID field is missing, so I cannot check it.

So a reference to ${Lead.Id} in  velocity never has a value.  Perhaps I am missing something.


Is there any way to do this, other than copying the Lead.id field to a custom field and then using that?

Thanks

.

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: Reference Lead.Id in Velocity

It's LeadID in the tree and $lead.leadID in VTL.

Peter_Liske4
Level 1

Re: Reference Lead.Id in Velocity

Sanford...thanks for confirming the name in VTL;  but in my instance, neither "Person ID" nor "Lead ID" show up in the tree of the Velocity script editor, and so I am unable to ever get a value for ${lead.leadID}.

I am curious if others have been able to successfully reference the Marketo Lead ID in Velocity?

SanfordWhiteman
Level 10 - Community Moderator

Re: Reference Lead.Id in Velocity

I knew I had just rolled out some very complex VTL that involved the $lead.leadID and that worked (and still does) but other instances I spot-checked didn't have it. Maybe this is a regression.

In any case you can get the ID, which is always in the context regardless, with

#set( $lead.Id = $convert.toInteger($mktmail.id.replaceAll("-.*${esc.d}","")) )

Grégoire_Miche2
Level 10

Re: Reference Lead.Id in Velocity

Hi All,

Just gave a look to 3 instances. No Lead ID field available...

One can also create a proxy field and fill it in with a smart campaign triggered on person creation.

-Greg

Peter_Liske4
Level 1

Re: Reference Lead.Id in Velocity

Thanks for confirming Greg, and Sanford, your code to get the lead ID from the mktmail.id worked like a charm.  Thank You. 
Peter