Supporting Multiple Languages in Email Templates

We are attempting to use Apache Velocity conditional statements to construct emails in different languages. Essentially @colin_mckibben 's solution on this topic.

The problem we are facing is that some templates are using V1 templates and some are using V2 templates. The V2 templates only allow for the use of 4 basic attributes (id, name, email & phone) whereas the V1 templates allow for broader use. How do we get emails in different languages for the templates using V2 templates?

We also noticed that the V2 templates are always used in the Test Email functionality, so it’s difficult to test since the V2 templates are limiting the attributes we are able to use.

Hi Jill,

I think you meant to say version 1 templates, not version 1 APIs.

V1 templates provide the user variable where you can essentially reference $.user.location (or whatever your location identity variable is called) in an email template.

V2 templates also provide all of the user’s identity attributes, but you have to go through the __util variable. I haven’t tried this myself, but I think the correct syntax is as follows:

$__util.getUser(userId).location

where userId is the identity ID of the user you want to get information about. If that person is the recipient of the email, then it would look like this:

$__util.getUser($__recipient.id).location

I tested this out and it doesn’t work. getUser() is limited to just name, email, and phone attributes. The V1 template doesn’t have this issue, as you can reference any identity attribute.

A related issue, for the Work Reassignment Created template and potentially the other V2 templates, the __recipient variable is an instance of that recipient class when testing but is a hash map of the identity attributes when the actual email is sent.

Thanks @colin_mckibben. I did mean templates and not APIs…I updated my topic so it wasn’t confusing for others. We aren’t having luck with the $__util.getUser() function either, which I think you found as well. We have a client with 9 language translations and we don’t think they’ll enjoy having every translation in the emails and having the user look for the one they can read. Are you looking into this further or should we put a ticket in?

try this to filter on the country embeded in the body of the email

#if(${newState} == “Active” && ${identity.country} == “Finland”)
body
#elseif(${newState} == “Active” && ${identity.country} == “Netherlands”)
body
#end

we have a different template for each of the nordic countries and this is how we resolved the problem

identity does not appear to be a supported variable for many of the V2 templates. I don’t think it’s possible to get the full attribute list from V2 templates. Here is an idea related to this request: https://ideas.sailpoint.com/ideas/GOV-I-820

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.