Localization Issue in Notifications Based on Account Language/Region
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2025 03:07 AM - edited 06-13-2025 03:27 AM
Hi everyone,
I’m facing an issue where the resolution code in my notifications is not being displayed in the correct language. I have resolution codes in multiple languages, and these are based on the Account’s preferred language or Region.
Here’s the scenario:
If the region is Germany, the resolution code should display in German.
However, in the notification, the resolution code is showing in English despite the region being set to Germany.
I’ve tried the following placeholders in the notification template:
${resolution_code.label}
${resolution_code.getValue()}
${resolution_code.getDisplayValue()}
None of these worked to display the localized resolution code in the correct language.
Below is my email Script code:
var account = current.account;
var lang = account.u_language;
if (!lang || lang.trim() === '') {
var region = account.u_region + '';
var regionLangMap = {
'Germany': 'de',
'Netherlands': 'nl',
'UK': 'en'
};
lang = regionLangMap[account.u_region] || 'en';
}
gs.setSessionLanguage(lang);
var resCodeDisplay = current.resolution_code.getDisplayValue();
resCodeDisplay;
I am calling this email script in my notification body:
Lösungs-Code: ${mail_script:resolution_code_basedon_region}
How ever, when I am doing preview, even though resolution code exists, it is showing as empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2025 04:32 AM
after code updated, I have tested this, still it is showing in English
Case Record:
The account which I have selected, language and region both are Germany
when I am doing preview of the notification, Resolution code is showing in English, Instead of Germany
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2025 04:40 AM
Did you add logs and see?
try running in background script and see
what's your script now since I gave 2 options and you need to update based on if you are in scoped/global application?
Did you check in email logs? don't use preview.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2025 06:32 AM
this is my script now
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Get account from the current task or context
var account = current.account;
var lang = account.u_language;
if (!lang || lang.trim() === '') {
var region = account.u_region + '';
var regionLangMap = {
'Germany': 'de',
'Netherlands': 'nl',
'UK': 'en'
};
lang = regionLangMap[account.u_region] || 'en';
}
//gs.setSessionLanguage(lang);
var resCodeDisplay = current.resolution_code.getDisplayValueLang(lang);
template.print(resCodeDisplay);
})(current, template, email, email_action, event);
I have created a case, tested that and closed the case, After that only it is coming in english