gs.getMessage() issue in email notifications

nagaraju8
Kilo Guru

Hi Guys,

I'm having my first go at an instance with multiple languages set up and having an issue with gs.getMessage() returning only English messages in notifications even though I have translated messages. I have tried logging in selecting other language and having other language set on a user record but still all I see is English messages.

Below are my translated messages.

MSG Translations.PNG

Email script name: (chubb_message)

var msg=gs.getMessage('chubb_message');

  email.setSubject(msg);

Notification: Message HTML field

Email script.PNG

Please any one suggest me on this?

Any help would be much appreciated!!

Regards,

NJ

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Short answer: The notification processing is happening in the background as the system account. It doesn't know what language the user is unless you tell it. If you are triggering the notifications from events, you can pass one of the parameters and then use that to get the proper message.



The approach I have used in multi-lingual is less elegant, but never failed. I trigger notifications from an event (ex: gs.eventQueue('my.notification', current, '', ''))



Then I have a notification for each language and a condition that checks the recipient's language. For example, if the message is going to the incident caller. These all respond to the same event trigger, but only the one matching the proper conditions gets sent.



Notification: Incident commented - EN


Condition: Caller.Language | is | English


(English subject and body)



Notification: Incident commented - FR


Condition: Caller.Language | is | French


(French subject and body)



and so on...



http://wiki.servicenow.com/index.php?title=Events_and_Email_Notification


Email Notifications - ServiceNow Wiki


View solution in original post

16 REPLIES 16

Chuck Tomasi
Tera Patron

Short answer: The notification processing is happening in the background as the system account. It doesn't know what language the user is unless you tell it. If you are triggering the notifications from events, you can pass one of the parameters and then use that to get the proper message.



The approach I have used in multi-lingual is less elegant, but never failed. I trigger notifications from an event (ex: gs.eventQueue('my.notification', current, '', ''))



Then I have a notification for each language and a condition that checks the recipient's language. For example, if the message is going to the incident caller. These all respond to the same event trigger, but only the one matching the proper conditions gets sent.



Notification: Incident commented - EN


Condition: Caller.Language | is | English


(English subject and body)



Notification: Incident commented - FR


Condition: Caller.Language | is | French


(French subject and body)



and so on...



http://wiki.servicenow.com/index.php?title=Events_and_Email_Notification


Email Notifications - ServiceNow Wiki


Thank you so much Chuck,



Regards,


NJ


If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.



If you are viewing this from the community inbox you will not see the correct answer button.   If so, please review How to Mark Answers Correct From Inbox View.



Thank you


Hi Chuck,



How can we access service catalog variables in email script?


I am using below script   but it does not works for me.


var user=current.requested_for;


Any suggestion!!



Regards,


NJ


Hi Nagaraju,

if requested_for is your variable name then you need to access variables in email scripts like current.variables.requested_for

This format is application for all kind of form variables.