Forum Discussion
We've done some quite extensive customisations of the email template but as far as I know there's no way of running Freemarker inside them, you're limited to the available context objects which can you view underneath the templates themselves in Studio... Related discussion here - https😕/community.khoros.com/t5/Developer-Knowledge-Base/Email-template-context-objects/ta-p/75924
One thing we did work out though was that it could be personalised to an extent... we had some custom user profile fields that we wanted to display in the emails which we were able to do by defining a Velocity variable at the start of the template as so:
#set($user_custom_field = ${user.get("custom.profile.custom_field")})
We could then display the contents of the custom field in the email body.
Would really be super useful if there was a way of querying the API in the templates though.
Hey Snaffle, thanks for sharing the knowledge. Do you think it is possible to use a community-wide custom setting from the SLE in the place of custom.profile.custom_field which you are getting in your Velocity variable with the Settings context objects given on the Email Templates page? Something like this for an example :
#set($user_custom_field = ${SettingByNameTemplateWrapper.get("custom.nav.event_items")})
TEST1 : $user_custom_field
OR
#set($user_custom_field1 =
${SettingsByNameLocalTemplateWrapper.get("custom.nav.event_items")})
TEST2 : $user_custom_field1
Because it is not working for me. Am I doing something wrong while printing it or the above mentioned context objects are not SLE context objects?
- snaffle6 years agoExpert
Hi pp_01 ,
I'm afraid I don't really no but to be honest I'd be surprised if that context object is available.
I think you could probably ask Support about that and they'd be able to find out for you or the very helpful, DougS, who pointed me in the right direction for the user context objects, might be able to chime in and answer this one.
Related Content
- 2 years ago
- 2 years ago
- 2 years ago