I've constructed a custom my token that access a custom object. But that object may not exist. I'd like to just display a default that can be passed in just like all of the regular tokens, but nothing seems to work. This is what I have in the email:
{{my.DisplayTitle:default=This is Default Title}}
However, the default here is never displayed. Is there someway to access this in the token script or pass back an "undefined" to trigger the default? The default seems to work fine with the standard tokens, but there doesn't seem to be a way to write your own token and show a default if nothing is defined.
Thanks!
That syntax doesn't work with Velocity tokens. But you can output a default value within the token. Yes, this means that having different defaults in different emails is annoying to set up.
Thanks! That's a bummer! It would be great if you could pass in some form of argument.
What I recommend is storing all strings in a separate token (a dictionary token, also used for language translations and such). Though it doesn't alleviate the need to include the dict at the email level if it's email-specific.
I have a blog post coming up on this topic... if you haven't already, check out my Velocity posts @ http://blog.teknkl.com/tag/velocity