SOLVED

Set local timezone using Velocity scripts

Go to solution
SanfordWhiteman
Level 10 - Community Moderator

Re: Set local timezone using Velocity scripts

Curious to your point about removing the {brackets} surrounding the fields. Why would it cause problems in the velocity script? We have that in place for all of our script and want to make sure they continue to function properly.

This blog post of mine should explain it: Velocity ${formal.notation} invites syntax errors: use it wisely

Victoria_Chu
Level 3

Re: Set local timezone using Velocity scripts

Update Sanford Whiteman​ - When I preview the email using a lead record, the script runs correct. However, in a real trigger/batch campaign, the script fails on the email, showing up blank. Can you think of why this would happen? Thanks.

SanfordWhiteman
Level 10 - Community Moderator

Re: Set local timezone using Velocity scripts

Showing up blank when the token exists is very rare. You should at least see an error dump.

Are you certain the token is in the folder hierarchy and the email is approved?

Victoria_Chu
Level 3

Re: Set local timezone using Velocity scripts

Yes and yes.

On Tue, Jan 8, 2019 at 5:42 PM Sanford Whiteman <marketingnation@marketo.com>

SanfordWhiteman
Level 10 - Community Moderator

Re: Set local timezone using Velocity scripts

And if you append another line to the token that just outputs some dummy text?

Victoria_Chu
Level 3

Re: Set local timezone using Velocity scripts

Sanford Whiteman​ I had put the script tokens in the program where the centralized alert email lives, not in the highest level of folder that houses all the program where the smart campaigns live. This explains perfectly why the preview worked but not the real send. Thanks for your help!

SanfordWhiteman
Level 10 - Community Moderator

Re: Set local timezone using Velocity scripts

Great!

Mark_Wallace1
Level 4

Re: Set local timezone using Velocity scripts

Hello All

Just discovered this and found I can put a webinar into the contacts local timezone using the person time zone field value.  Fantastic.

Wanted to check is it possible to put the local campaign tokens into the velocity script.  Im currently including the webinar times by putting the webinar times into a field, when they are already in a local token.

If I could put the webinar start time token into the script that would make my day.

thanks for this

SanfordWhiteman
Level 10 - Community Moderator

Re: Set local timezone using Velocity scripts

What do you mean by "local campaign tokens"?  The built-in {{campaign.tokens}}?