SOLVED

Re: Custom token referenced in another token

Go to solution
Anonymous
Not applicable

Custom token referenced in another token

Hello Marketo community,

I built a custom token named {{my.Prior Month MMMM}} in my active marketing campaigns folder that reads:

#set($calendar = $date.getCalendar())  

$date.format('MMMM',$calendar)

This populates in email copy successfully when referenced, e.g. "June", "May", etc.

I'm trying to reference this token with a custom token named {{my.PNGreetingSurpluskWhvsOnTrack}} in a program that is nested within the active marketing campaigns folder. When I include it in the token below, it doesn't populate in an email and just displays the token name. Any recommendations would be greatly appreciated. Thanks!

Daniel

Custom token {{my.PNGreetingSurpluskWhvsOnTrack}} to be referenced in an email draft:

##check if the monitored production is > OR < estimated production

##check if the monitored production is > estimated production

#if(${lead.pNOnTrackClassification} == "100+")

  ##if the lead has more monitored production than estimated, tell them how large the surplus kWh hours were

  #set($my.PNGreetingSurpluskWhvsOnTrack = "Your system produced ${lead.pNMonitoredvsEstimatedSurpluskWh} kWh more than we forecasted in {my.Prior Month MMMM}!*")

##check if the monitored production is < estimated production

#else

  ##if the lead has less monitored production than estimated, tell them they are on track

  #set($my.PNGreetingSurpluskWhvsOnTrack = "Your system's {{my.Prior Month MMMM}} production was right on track with forecasted production!*")

#end

${my.PNGreetingSurpluskWhvsOnTrack}

1 ACCEPTED SOLUTION

Accepted Solutions
Grégoire_Miche2
Level 10

Re: Custom token referenced in another token

Hi Daniel,

I do not think it would work either. But the workaround is easy and you can set and use you $calendar variable in the second token.

-Greg

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Re: Custom token referenced in another token

I have tried this before myself and I do not think it will work, unfortunately

Grégoire_Miche2
Level 10

Re: Custom token referenced in another token

Hi Daniel,

I do not think it would work either. But the workaround is easy and you can set and use you $calendar variable in the second token.

-Greg

Anonymous
Not applicable

Re: Custom token referenced in another token

Thanks for replying, Jamie and Gregoire.

I successfully tested the following. Thanks you both for you help!

##Get prior calendar month

#set($calendar = $date.getCalendar()) 

$calendar.add(2,-1)

#set($priorMonth = $date.format('MMMM',$calendar))

##check if the monitored production is > OR < estimated production

##check if the monitored production is > estimated production

#if(${lead.pNOnTrackClassification} == "100+")

  ##if the lead has more monitored production than estimated, tell them how large the surplus kWh hours were

  #set($my.PNGreetingSurpluskWhvsOnTrack = "Your system produced ${lead.pNMonitoredvsEstimatedSurpluskWh} kWh more than we forecasted in $priorMonth!*")

##check if the monitored production is < estimated production

#else

  ##if the lead has less monitored production than estimated, tell them they are on track

  #set($my.PNGreetingSurpluskWhvsOnTrack = "Your system's $priorMonth production was right on track with forecasted production!*")

#end

${my.PNGreetingSurpluskWhvsOnTrack}

Grégoire_Miche2
Level 10

Re: Custom token referenced in another token

That's it

Anonymous
Not applicable

Re: Custom token referenced in another token

Since I'm now going to explore custom tokens for a variety of dynamic email copy needs, might you know of a good resource for sample tokens? All I can find is the following: http://developers.marketo.com/documentation/velocity-script/script-examples/

I'm trying to build out my second token, but running into an issue. My email copy doesn't actually populate with the URL from either fields. The email just reads: "${my.OnemonthvsgreaterthanonemonthmonitoredkWh}".

The token script is for {{my.One month vs greater than one month monitored kWh}}:

##check if there is monitored production == 1 month OR > 1 month

##check if the monitored production is == 1 month

#if(${lead.pNofMonthsMonitoredkWh} == "1")

  ##if the lead has 1 month of monitored production than use monitored vs. estimated image src for graph

  #set($OnemonthvsgreaterthanonemonthmonitoredkWh = "${lead.pNMonitoredvsEstimatedImageURL}")

##if the monitored production is <> "1"

#else

  ##if the lead has 1 month of monitored production than use monitored vs. historical image src for graph

  #set($OnemonthvsgreaterthanonemonthmonitoredkWh = "${lead.pNHistoricalMonitoredImageURL}")

#end

${my.OnemonthvsgreaterthanonemonthmonitoredkWh}

Grégoire_Miche2
Level 10

Re: Custom token referenced in another token

Hi Daniel,

there are a few posts. Search the community for the keyword velocity

Greg