- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 08:59 PM
How to call "Message Key"(Created in sys_ui_message) in Mail Script.
I have created 2 messages with same key name in sys_ui_message table.
One message for "English" and the other one for "Japanese". I have selected language as English and Japanese.
When I'm using above mail script for Japanese notification also getting English Message. Please suggest
Message Key - Japanese
Message Key - English
Mail Script
(function runMailScript(current, template, email, email_action, event) {
var link = gs.getProperty('property.name');
var msg=gs.getMessage('Click Here For URL');
template.print('<a href="'+link+'">'+msg+'</a>');
})(current, template, email, email_action, event);
When I'm using above mail script for japanese notification also getting English Message. Please suggest
Regards,
Sruthi
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 09:43 PM
Hi there,
Within mail script, you could consider applying getMessageLang().
gs.getMessageLang('message_key', 'language_id');
2021-07-01 Return a message in a specific language, gs.getMessageLang()
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 09:04 PM
You only need to keep your English text within the getMessage function. System automatically does the translation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 09:07 PM
Hi Anirudh,
I only keep English message key in the getMessage function. The key is same for both English and Japanese.
Regards,
Sruthi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 09:13 PM
Oh now I get it.
Try changing the Japanese script to something else (in English)...
If it shows up in the mail, then the problem is not with the translation but with showing the Japanese script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 09:17 PM
Hi Anirudh,
My query is like how to call the "Message Key" in the mail script. and while using the below script Japanese notification also getting English Message.
Click Here For URL - This is Message key for both English and Japanese. Only Message will be different.
(function runMailScript(current, template, email, email_action, event) {
var link = gs.getProperty('property.name');
var msg=gs.getMessage('Click Here For URL');
template.print('<a href="'+link+'">'+msg+'</a>');
})(current, template, email, email_action, event);