- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 12:39 PM
I have a requirement to translate notifications.
I started with OTB notification called 'INC - Assigned to Me'.
I've been successful in translating the body of the notification using GlideRecords on the sys_user_perferences and sys_ui_messages.
I am having difficultly doing the same for the Subject field. The Subject field appears to be a plain text so whatever message is in the sys_ui_message, is displaying in the notification.
For example, this is what appears in the subject:
English:
You have been assigned Incident ${number}
Japanese
貴職がインシデントチケット: ${number} の担当者に割り当てられました
My notification calls a notification mail script for the subject:
${mail_script:INC - Assigned to Me-Subject}
Here is ${mail_script:INC - Assigned to Me-Subject} script:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
var language;
var grPref = new GlideRecord('sys_user_preference');
grPref.addQuery('user', current.assigned_to);
grPref.addQuery('name', 'user.language');
grPref.query();
gs.log("MRB subject");
if(grPref.next()) {
language = grPref.value;
gs.log("MRB language subject: " + language);
}
if (language == 'en' || !language)
langValue = "en";
else if (language == 'ja')
langValue = "ja";
gs.log("MRB langValue subject: " + langValue);
var gr = new GlideRecord('sys_ui_message');
gr.addQuery('key', 'INC - Assigned to Me-Subject');
gr.addQuery('language', langValue);
gr.query();
gs.log("MRB before next subject subject");
if(gr.next()) {
var message = gr.message;
gs.log("MRB message subject: " + message); //Output in whichever way you need.
email.setSubject(message);
}
})(current, template, email, email_action, event);
Coding gs.getMessage("xxx") in the Subject field of the notification will pull in the message from sys_ui_message but it doesn't convert ${number} to the ticket number. ${gs.getMessage("xxx")} leaves the subject blank.
Any suggestion appreciated.
Marc
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 01:02 PM
HI,
You will have to create email in different language's and trigger them based on user language.
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 01:02 PM
HI,
You will have to create email in different language's and trigger them based on user language.
Thanks,
Ashutosh