Using {{program.id}} inside velocity?

Chris_Wilcox
Level 9

Having the hardest time figuring out how to access the {{program.id}} value inside of a velocity script token.

 

I found @SanfordWhiteman 's article with the workaround, but having trouble implementing it. 

 

https://blog.teknkl.com/accessing-the-program-id-and-campaign-id-from-velocity-the-new-way-post-june...

 

I put this short script in the <head> my email template (I can't using the unsubscribe HTML section like he suggested), and I can see the value populating correctly in the head.

<script>
#set ($MAContext = {
	"programId" : "{{program.id}}"
})
</script>

Now, I'm struggling with how to access that value later in my email inside my script token. 

 

I tried using this, but didn't work. 

${MAContext.programId}

 

Anyone ever done this before?

14 REPLIES 14