SOLVED

Re: Velocity Token Value pull in

Go to solution
SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity Token Value pull in

Please use the syntax highlighter so it's readable, thanks.

Jo_Pitts1
Level 10 - Community Advisor

Re: Velocity Token Value pull in

@freeza 

Asides from the lack of syntax highlighting, there are many problems (syntax, and possibly business logic).

Let's step back.  What are you actually trying to do here.

Cheers

Jo

freeza
Level 3

Re: Velocity Token Value pull in

I have this email content below is a screenshot. From the Velocity Token I have. I want the Event Title, When and Where to be generated according to the HUG Event the user choses. 

 

Jo_Pitts1
Level 10 - Community Advisor

Re: Velocity Token Value pull in

So, the link I posted in an earlier reply is EXACTLY what you need with a few tiny tweaks

 

#set( $allEventDetails = {
  "Seattle HUG: UserTesting Hacks (4/7 10 am Pacific)" : {
    "when":"The right date and time for Seattle",
    "where":"A link to your Seattle meeting - make sure and escape things like quotes"
  },
  "London HUG: Some Stuff about Hugs (4/7 10 am GMT)" : {
    "when":"The right date and time for London",
    "where":"A link to your London meeting - make sure and escape things like quotes"
  },
  "NZ Hug: It ain't all about the sheep" : {
    "when":"The right date and time for New Zealand",
    "where":"A link to your NZ meeting - make sure and escape things like quotes"
  }
}
)

#set( $aEvent = $allEventDetails[$lead.hUGEventChoice]) 

<p><b>When:</b>${aEvent.when}</p>
<p><b>Where:</b>${aEvent.where}</p>

 

Put all that in a velocity token... then, where you want the output, put in the {{my.whateverYourTokenIsCalled}}

My usual caveat applies.. I've not tested or debugged this.

Cheers

Jo

freeza
Level 3

Re: Velocity Token Value pull in

So I have this,

But it keeps giving me an error. I attached the screenshot of the error I am getting.Screen Shot 2022-03-23 at 11.43.14 PM.png

 

 

 

 

This is how I am calling in the email

 

 

 

Jo_Pitts1
Level 10 - Community Advisor

Re: Velocity Token Value pull in

OK.. Nothing happening here is good.

you can't have all those quotes in the link like that (hence why I said they needed escaping).

Also, look at what the code is doing.... the final output stage outputs

Title: aEvent.title

When: aEvent.when

Where: aEvent.where

you only need to call the token once.

Just make your links (for now) some thing simple like the word BOB.  

Then once you've got that working, I'll loop back to the links issue.

freeza
Level 3

Re: Velocity Token Value pull in

Okay, Thank you for that. This is my first time using Velocity that's why.

I was able to solve the issue.

 

How can I go about adding the Links now?

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

freeza
Level 3

Re: Velocity Token Value pull in

Great! I tested out and everything is working as expected. Thank you so much for your help! Really appreciate it.

 

 

Jo_Pitts1
Level 10 - Community Advisor

Re: Velocity Token Value pull in

Fathima,

I'm super pleased you got it all working.

Can you mark my solution as correct please?

Cheers

Jo