#set( $defaultTimeZone = $date.getTimeZone().getTimeZone("America/New_York") )
#set( $defaultLocale = $date.getLocale() )
#set( $calNow = $date.getCalendar() )
#set( $ret = $calNow.setTimeZone($defaultTimeZone) )
#set( $calConst = $field.in($calNow) )
#set( $ISO8601 = "yyyy-MM-dd'T'HH:mm:ss" )
#set( $ISO8601DateOnly = "yyyy-MM-dd" )
#if ($calNow.get($calConst.$date.getCalendar) <= {{my.webinar 1 DT}} )
#set ($mywebinardate= "{{my.webinar 1 DT}}")
#set ($mywebinarurl= "https://event.on24.com/wcc/r/2021571/16048F8C9FD8F66DE96DBE1ECEE3DFEB")
#elseif ($calNow.get($calConst.$date.getCalendar) <= {{my.webinar 2 DT}} )
#set ($mywebinardate= "{{my.webinar 2 DT}}")
#set ($mywebinarurl= "https://event.on24.com/wcc/r/2021573/51B046F601D036C3D8F47F3A80F4E779")
##print the myvalue
$mywebinardate
$mywebinarurl
#end>
I am getting hung up on where I would need to set the webinar dates, and URLS display the URLs? Can I set the webinar dates and URLs directly in the script token, or do I have to use separate my.tokens to set them and reference them in the script?
You can use another token, but another Velocity token, not a generic token.
If {{my.token1}} has
#set( $webinarDate = "2019-06-0712:00:00" )
#set( $webinarTZ = "America/New_York" )
and {{my.token2}} does the date processing, then you just to include {{my.token1}} before (that is, anywhere above) {{my.token2}} in the email.
{{my.token1}}{{my.token2}}
Splitting across different "data", "config", and "code" tokens is definitely a best practice for maintainability.
Thanks Sanford.
So would I set the various webinar dates in 1 velocity token that is referenced in the date processing? Also, what about the various URLs? Would they also be in their own V-Token?
This is what I have so far in my "Date processing token" and I'm getting stuck:
#set( $defaultTimeZone = $date.getTimeZone().getTimeZone("America/New_York") )
#set( $defaultLocale = $date.getLocale() )
#set( $calNow = $date.getCalendar() )
#set( $ret = $calNow.setTimeZone($defaultTimeZone) )
#set( $calConst = $field.in($calNow) )
#set( $ISO8601 = "yyyy-MM-dd'T'HH:mm:ss" )
#set( $ISO8601DateOnly = "yyyy-MM-dd" )
#if( $calNow.get($calConst.$date.getCalendar) > {{my.webinar 1 DT}})
#set {{$mywebinardate= "{{my.webinar 1 DT}}")
#set {{$mywebinarurl= "https://event.on24.com/wcc/r/2021571/16048F8C9FD8F66DE96DBE1ECEE3DFEB")
My confirmation email needs to have these two varying values, that are dependent on the date populated:
Event Date and Time: {{my.webinardate}}
Link: {{my.webinarurl}}
But where would my data processing token go in this scenario? What am I getting wrong?
Can you highlight the code using the Advanced Editor's syntax highlighter so it's readable? (Use Java as it's closest to Velocity.) Then we'll continue.
I can already see you changed from the code I suggested. Don't do that! I wasn't just sketching out a concept, that was actual valid Velocity. When you change things with adding double curly braces and such, that's breaking the syntax.
I'm attempting to get the markdown to work -- hopefully, this works after I post.
#set( $defaultTimeZone = $date.getTimeZone().getTimeZone("America/New_York") )
#set( $defaultLocale = $date.getLocale() )
#set( $calNow = $date.getCalendar() )
#set( $ret = $calNow.setTimeZone($defaultTimeZone) )
#set( $calConst = $field.in($calNow) )
#set( $ISO8601 = "yyyy-MM-dd'T'HH:mm:ss" )
#set( $ISO8601DateOnly = "yyyy-MM-dd" )``
#if ($calNow.get($calConst.$date.getCalendar) <= {{my.webinar 1 DT}} )
#set ($mywebinardate= "{{my.webinar 1 DT}}")
#set ($mywebinarurl= "https://event.on24.com/wcc/r/2021571/16048F8C9FD8F66DE96DBE1ECEE3DFEB")
#elseif ($calNow.get($calConst.$date.getCalendar) <= {{my.webinar 2 DT}} )
#set ($mywebinardate= "{{my.webinar 2 DT}}")
#set ($mywebinarurl= "https://event.on24.com/wcc/r/2021573/51B046F601D036C3D8F47F3A80F4E779")
##print the myvalue
$mywebinardate
$mywebinarurl
#end>
Feels like you need to read my blog post a lot more thoroughly. There are examples there that you aren't using, and you seem to be conceptualizing other methods that won't even compile (syntax errors).
Maybe you need to get a Velocity developer involved?