gs.getMessage() in email notification

dante3
Tera Expert

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:

find_real_file.png

but in email:

find_real_file.png

disregard the INC #

thanks!

1 ACCEPTED SOLUTION

Jesper Sandberg
Tera Expert

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.


}


View solution in original post

5 REPLIES 5

Hi Dante,



You can query the user that the notification is being sent to and then find out what language to use.


I believe ServiceNow's official way is to use one language per notification, so you should create additional notifications per language, see


"10.1 Specifying An Outbound Email Address for a Particular Language" in this link: Email Notifications - ServiceNow Wiki


It shows you how you can set the condition to check for the incident's caller's language.



For groups I don't know if it is possible to do like this, perhaps someone knows more about this than I do?