Using {{}} inside velocity?

Level 2

Re: Using {{}} inside velocity?

Hi Chris - Were you ever able to make this work? We have been looking for a similar workaround for a while now.

Level 9

Re: Using {{}} inside velocity?

Nope, I abandoned this idea and went instead to try to get Asset ID (which I could then, via the API, associate back to a program ID since an asset can only exist in 1 program). 


I did KIND OF get asset ID working. It worked in the sense that the code does dynamically populate the asset ID of the email it's within, however my goal was to use the script to populate a querystring element with that emails' Asset ID to associate pageviews to individual emails dynamically and at scale, but the velocity script does not run if it's included as a part of a TRACKED link. Works perfectly in an email body or in the HTML, or even an untracked link.  But as soon as you try to use velocity in a tracked link, it breaks, does not run, and the query element just shows the velocity code instead of the code executing.  


It's apparently a limitation of the email compiler to be able to run velocity and within the tracked URL, then generate the tracked link. I was disappointed. 


#set( $delim = ":|-" )
#set( $values = $mktmail.xMarketoIdHdr.split($delim) )
#set( $assetId = $values[7] )