(Static) Multi-lingual notification support - ServiceNow Community
Mark Roethof
Tera Patron
Tera Patron

Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

 

Hi there,

 

Working on multi-language instances, a common request is sending emails in various languages. Out-of-the-box, ServiceNow does not support this. I have created solutions for customers in the past to mimic this, though it always felt like a huge gap within ServiceNow. It used to... with the Tokyo release "Multi-lingual notification support" is introduced!

 

Let's give it a try.


Pre-Tokyo

Setting up notifications in various languages, you could see several "solutions" out there. For example:
- Adding a condition to the Notification, validating the language of the email sender. Easy to set up and for some customers this would work fine. Though what if the senders language setting is not the same as the receivers language setting?
- Scripting the subject and message body, using gs.getMessageLang() to translate all text to match the receivers language setting. This works fine, though will require all text to be added as UI Messages. Also... this only works for one receiver, not when working with a watch list or a group which contains receivers with different language settings.
- Creating separate events for all receivers of the Notification, to be able to validate the individual receivers language settings and send the Notification in the correct language. Works well, though the customizations needed for these are way too much.

Tokyo

During the TechNow episode regarding the Tokyo release, static multi-lingual notification support was covered. In theory you would have your normal Notification record, and add a "Translated Notification" record [sys_translated_notification] for each language you are after. While a Notification record is used as example here, this works the same on Email Templates and Email Layouts.

 

find_real_file.png


Activating static multi-lingual notification support

There are some steps you need to take before the static multi-lingual notification support is available to use.

1. Install (free) plugin "Glide Notification Translation" [com.glide.notification.translation]
2. Add System Property "glide.email.outbound.static_translation.enabled", and give it value "true"

After having performed these two steps, the "Translated Notifications" related list should be available on Notifications... when viewing the Advanced view!


Translated Notifications

Let's set up a test Notification, and assuming the default value should be English. From the related list Translated Notifications, add a new Translated Notification record and select the language you are after, adding a Subject and Message HTML. The result could look something like below:

 

find_real_file.png

 

To be able to test this Notification, I added some simple conditions so the Notification would trigger easily when updating an Incident. Also I made sure that multiple users were added to the Incidents watch list. Users with the default system language setting (English), and users with a Dutch language setting.


Emails

After simulating the Notification trigger conditions on the Incident, an Email record [sys_email] will be generated. At first sight, you might think it's not working. Only the Notification in the English language is shown... Though when opening the Email record, notice the "Email Log" related list:

 

find_real_file.png

 

For the Notification, actually two Translated emails have been generated, one for English, one for Dutch! I did verify the actual emails which were sent, works like a charm 😀.


Recap

It took ServiceNow a while, though sending emails in various languages is now out-of-the-box available. And good to know, it works fine when also working with a watch list or groups as receivers.

---


And that's it. Hope you like it. If any questions or remarks, let me know!

 

C

If this content helped you, I would appreciate it if you hit bookmark or mark it as helpful.

 

Interested in more Articles, Blogs, Videos, Podcasts, Share projects I shared/participated in?
- Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

 

Kind regards,


Mark Roethof

Independent ServiceNow Consultant
3x ServiceNow Developer MVP

3x ServiceNow Community MVP

---

LinkedIn

 

Comments
Mariusz Kaluga
Tera Contributor

Hi Mark, 
Thanks for that, I think issue could be when you are sending email to group Id which has own email, then is sending default language not per user settings. 

Regards Mariusz  

Manal  AQUIL
Tera Contributor

@Mark Roethof Very nicely explained, thanks for sharing this.

Tony60
Kilo Guru

Hi @Mark Roethof ,

very cool and often requested feature. Thank you for the detailed explanation.

A question regarding the user language:

Do you know if user preferences are taken into account for the language specific notification? This can differ from the language in the user record.

Thanks in advance!

MateoBilandzija
Tera Expert

@Mark Roethof  Does the Log shows only when the Notification is sent because I dont see the Notification in my Log in my Test Enviroment

Ravi Chandra_K
Kilo Patron

This article is very helpful Mark!

Thank you!

one thing I have observed is

the user preference is user's language in user profile record.

not from the user preference table (user.language user preference).

for some users who do not have access to change the language from user profile, but user preference set from the preference table, the translations will not be sent.

hope ServiceNow enhances this in future.

Kind Regards,

Ravi Chandra.

JP - Kyndryl
Kilo Sage

Hi Ravi,

You are totally right.

We remediated this with the following BR that sets the User Profile's language based on the User Preference:

 

JPKyndryl_0-1689682856505.png

 

(function executeRule(current, previous) {
    //Update the user's profile language based on user preference
    gr = new GlideRecord('sys_user');
    gr.addQuery('user_name', current.user.user_name);
    gr.query();
    while (gr.next()) {
        gr.preferred_language = current.value;
        gr.update();
        }
})(current, previous);
 
Aivaras Go
Tera Contributor

Hello,

 

It's all good and well, however I still do not fully understand mail script usage within translated notifications.

Servicenow static translation documentation says:

  • The static content that needs to be translated in mail scripts must be present inside gs.getMessage() and translations for the strings must be available in the Message [sys_ui_message] table​.

Let's say we have a salutation email in English (default) + Swedish and Danish translated versions of emails.
Overall, we have base email notification in English containing single line:

 

 

 

${mail_script:salutation}

 

 

 

And 2 translated versions of same email containing same thing:

 

 

 

${mail_script:salutation}​

 

 

 


Mail script "salutation" contains one line:

 

 

 

template.print(gs.getMessage("greetings"));

 

 

 


"greetings" is translated in all 3 languages (en,sv,da) and stored in [sys_ui_message] table.


Now, reading documentation I was under impression that salutation email contents will be translated automatically based on recipients language.
e.g if email in [sys_translated_email_content] has sv language set, gs.getMessage("greetings") used within mail script would return token in Swedish. However that's not the case.

Is our observation an expected behavior or rather a bug?

And if it's expected behavior maybe 
there is option to get outbound email language context in mail script, so we can apply gs.getMessageLang() in correct language context?

Aivaras

Community Alums
Not applicable

@Aivaras Go Have you found a way to this problem, We're also using gs.getMessage() where we've few mail scripts, we couldn't find any new api's along with which could be leveraged within email scripts for sys_translated_email_content. 

Community Alums
Not applicable

Glide Notification Translation (com.glide.notification.translation) doesn't cover/provide apis for this aspect w.r.t email script usage to get static translation content.

Version history
Last update:
‎08-03-2024 10:23 AM
Updated by:
Contributors