- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2016 12:48 PM
Hello everyone,
I'm using Geneva version.
I'am creating an email notification that will include the gs.getMessage in mail script.
With the preview button it automatically convert a string in current selected language which is good.
but when it's sent the content of the email is still English.
Preview email notification:
but in email:
disregard the INC #
thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2016 02:43 AM
Hi Dante,
I have not tested this, but I assume it's a bug, that it does not convert when sending.
What you could do as a workaround, is to query the message table (sys_ui_message) directly and get your message.
var gr = new GlideRecord('sys_ui_message');
gr.addQuery('key', 'YOUR_KEY');
gr.addQuery('language', 'YOUR_LANGUAGE');
gr.query();
if(gr.next()) {
gs.log(gr.message); //Output in whichever way you need.
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2016 02:29 AM
Hi Dante,
you might want to check here : Language Internationalization - ServiceNow Wiki
4.4 Message
The Message [sys_ui_message] table contains the translations for informational messages, confirmation messages, error messages, and other types of system messages. ServiceNow checks this table for translated text when a client script contains a getMessage call or a server script contains a gs.getMessage call. The main fields for this table are:
- Application: name of the application this message appears in.
- Key: internal unique identifier of this message.
- Language: language the message is translated into.
- Message: translated text that users see.
Hope this helps
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2016 02:43 AM
Hi Dante,
I have not tested this, but I assume it's a bug, that it does not convert when sending.
What you could do as a workaround, is to query the message table (sys_ui_message) directly and get your message.
var gr = new GlideRecord('sys_ui_message');
gr.addQuery('key', 'YOUR_KEY');
gr.addQuery('language', 'YOUR_LANGUAGE');
gr.query();
if(gr.next()) {
gs.log(gr.message); //Output in whichever way you need.
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2016 05:41 AM
I see thanks for the quick response.
follow up question:
I will get the language to the user who triggered the notification ? of to the one who sent out?
what if for example in a group there are users that has different languages?
thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2016 05:49 AM
Hi,
Emails aren't sent by a user, they're sent by the system so gs.getmessage will run as the system and so translate into the system language (in this case English).
Also, you already pointed out the situation with translating an email. Who do you translate it for? the person who triggered it, the person who its going to? and what if there are multiple languages in the group
One of the things you can look at doing is adding all the applicable languages in the same email. So a query across all the recipients for their language, and then append each translation underneath using the gliderecord which Jesper posted already (but I'd add a gr.setLimit(1) just for performance reasons).
Also, you'd probably want a fall back if it can't find the relevant translation to send a default language.