SOLVED

Velocity Token Value pull in

Go to solution
freeza
Level 3

Velocity Token Value pull in

Hello,

How can I pull in the values from my Velocity Token. 

##check if HUG Event Choice is Chicago HUG
#if(${lead.HUG Event Choice} == "Seattle HUG: UserTesting Hacks (4/7 10 am Pacific)")
#set($event.title = "Seattle UserTesting Hacks HUG Event")
#set($event.date = "Thursday, April 7th at 10 AM PT")
#set($event.destination = "<a href="https://usertesting.zoom.us/j/98148200405?pwd=K0d3SFFJWFpvY1FMN2RQWWMvSXkvUT09" style="color: #315CFD; text-decoration: underline;" target="_blank">Remotely via Zoom</a>")
##check if HUG Event Choice is London HUG

………….

#end

for something like this. In the email if I want the event.title

how can I pull that field into the email?

is it something similar to this? ${{my.HUGEventChoice_event.title}}

My token name is {{my.HUGEventChoice}}

3 ACCEPTED SOLUTIONS

Accepted Solutions
Jo_Pitts1
Level 10 - Community Advisor

Re: Velocity Token Value pull in

@freeza ,

getting out in front of the link question that'll be coming next.  Do it like this.  You don't need to replicate the styles, html etc. etc. etc.

 

#set( $allEventDetails = {
  "Seattle HUG: UserTesting Hacks (4/7 10 am Pacific)" : {
    "title":"Seattle UserTesting Hacks HUG Event",
    "date":"Thursday, April 7th at 10 AM PT",
    "destination":"usertesting.zoom.us/j/98148200405?pwd=K0d3SFFJWFpvY1FMN2RQWWMvSXkvUT09"
  },
  "London HUG: UserTesting Hacks (4/12 2 pm GMT)" : {
    "title":"London UserTesting Hacks HUG Event",
    "date":"Tuesday, April 12th at 2 PM GMT",
    "destination":"usertesting.zoom.us/j/97207484508?pwd=dHRyakZ2c2orQ1FMM28vMk5aMU80QT09"
  },
  "Chicago HUG: UserTesting Hacks (4/19 10 am Central)" : {
    "title":"Chicago UserTesting Hacks HUG Event",
    "date":"Tuesday, April 19th at 10 AM CT",
    "destination":"usertesting.zoom.us/j/97012930463?pwd=d2h0TGc4cXZYaTJ2ZWdDUGpCNkUxdz09"
},
"Texas HUG: UserTesting Hacks (4/28 10 am Central)" : {
    "title":"Texas UserTesting Hacks HUG Event",
    "date":"Thursday, April 28th at 10 AM CT",
    "destination":"usertesting.zoom.us/j/94723137214?pwd=ZzZuNkZlWG1SM3M1VE80a3ZvdmZyUT09"
}
}
)
#set( $aEvent = $allEventDetails[$lead.hUGEventChoice]) 

<p>Title:${aEvent.title}</p>
<p><b>When:</b>${aEvent.when}</p>
<p><b>Where:</b><a href="https://${aEvent.where}" style="color: #315CFD; text-decoration: underline;" target="_blank">Remotely via Zoom</a></p>

 

That should be getting pretty close to what you need

View solution in original post

Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Velocity Token Value pull in

You will need to create a separate velocity token to do that (i.e. just display the title), add that token in the subject line and you should be good to go! You'll be able to reference data set in the variable in your original token!

View solution in original post

Jo_Pitts1
Level 10 - Community Advisor

Re: Velocity Token Value pull in

Yep.  Just create a very simple token that has in it

${aEvent.title}

And pop that in the subject.  Fortunately, Marketo does the body processing before the subject line processing, so the variable is all nicely set for use.

View solution in original post

31 REPLIES 31
Jo_Pitts1
Level 10 - Community Advisor

Re: Velocity Token Value pull in

I wrote a really long reply to this when it was in the wrong board.

Now I can't find it.

 

@freeza , did you delete your original, and re-create it in the product discussion board?

SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity Token Value pull in


@Jo_Pitts1 wrote:

I wrote a really long reply to this when it was in the wrong board.

Now I can't find it.

 

@freeza , did you delete your original, and re-create it in the product discussion board?


Jo, I moved it, but your response wasn’t there (anymore) even on the other board. I’ll see if I can restore it.

Jo_Pitts1
Level 10 - Community Advisor

Re: Velocity Token Value pull in

Thanks.  It covered (I think) most of the things you'd have raised 🙂

freeza
Level 3

Re: Velocity Token Value pull in

Thank You!

SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity Token Value pull in

Sorry, can’t retrieve it. Maybe you moved it somewhere weird?

Jo_Pitts1
Level 10 - Community Advisor

Re: Velocity Token Value pull in

Not sure how I'd even do that.  Maybe I'll find out soon 🙂

freeza
Level 3

Re: Velocity Token Value pull in

Thank You, if could restore and post it here please. It would be a big help.

Jo_Pitts1
Level 10 - Community Advisor

Re: Velocity Token Value pull in

@freeza 

OK.. so a shorter version of what I wrote before (to save @SanfordWhiteman from having to find and restore my earlier reply)

 

so, my first comment originally was for you to use the code highlighter, but I see that's happened.  

 

Then:

  1.  lead.HUG Event Choice isn't a valid field name in Velocity.  Drag and drop it from the RHS object tree to get the correct api/velocity friendly name
  2. Don't use {} around a variable unless you are wanting to display it.  And to that point, to write a Velocity variable out, simply go ${myVelocity Variable}
  3. Use .equals() instead of == (so your code should look like #if($myVar.equals("Seattle HUG: UserTesting Hacks (4/7 10 am Pacific)")
  4. As a more strategic view, rather than having a massive and very repetitive list of if statements, take a look at this post.  It might provide you more of a direction to take with this piece of work https://nation.marketo.com/t5/product-discussions/email-script-token-shows-token-as-text/m-p/320763/...

Cheers

Jo

freeza
Level 3

Re: Velocity Token Value pull in

Does this look good?

 

##check if HUG Event Choice is Seattle HUG
#if($(lead.hUGEventChoice.equals("Seattle HUG: UserTesting Hacks (4/7 10 am Pacific)"))
#set($event.title = "Seattle UserTesting Hacks HUG Event")
#set($event.date = "Thursday, April 7th at 10 AM PT")
#set($event.destination = "<a href="https://usertesting.zoom.us/j/98148200405?pwd=K0d3SFFJWFpvY1FMN2RQWWMvSXkvUT09" style="color: #315CFD; text-decoration: underline;" target="_blank">Remotely via Zoom</a>")

........
#end