logo

NJP

Multilingual for a Group Notifications – Watch_list

Import · Feb 04, 2020 · article

Hi all,

In some cases we could have in the same group members speak different languages, like assignment_group or watch_list or ….

In this section we will handle the notification sent to watch_list and the caller_id when a comment has been added, for users with English and German Languages.

Please below the steps as described below:

  • Create new update set “Multilingual Notification” and make it as current.
  • Install plugins:
    1. I18N: Internationalization
    2. i18 for german language.
  • Select 4 or 5 users and set the languages for them (2English, 2 German).
  • Create 2 notifications one for English and one for German.
  • Create 2 Events
  • Create one business rule to trigger those events.

Details,

  • First we Create 2 events as below:

Filter navigation, System Policy à Events à Registy à new

Name: notification.german, table: Inciden

image

Again the same thing for English notification:

Name: notification.english, table: Incident

image

  • Second we create 2 notifications as below:

System Notification à Email à Notifications à New

Name: Notification DE, table: incident, when to send: event is fired, event name: notification.german, who will receive: Event param 1 and what it will contain you can type what you want.

image

image

The same for the English notification

Name: Notification EN, table: incident, when to send: event is fired, event name: notification.english, who will receive: Event param 1 and what it will contain you can type what you want.

image

image

  • Finally we create the business rule in the incident table to trigger those events notifications as below:

image

Below the script:

(function executeRule(current, previous /*null when async*/) { // 2 array to locate german, english users var ids_german = []; var ids_english = []; var list = current.watch_list.toString(); var array = list.split(","); for (var i=0; i < array.length; i++) { gs.log("languages: " + array[i]); var user = new GlideRecord('sys_user'); user.addQuery('sys_id',array[i]); user.query(); while(user.next()) { if(user.preferred_language!='de') { ids_english.push(user.sys_id.toString()); } if(user.preferred_language=='de') { ids_german.push(user.sys_id.toString()); } } } if(current.caller_id.preferred_language=='de') { gs.log("German"); ids_german.push(current.caller_id.toString()); } if(current.caller_id.preferred_language!='de') { ids_english.push(current.caller_id.toString()); gs.log("English"); } gs.eventQueue('notification.english',current,ids_english,current.sys_id); gs.eventQueue('notification.german',current,ids_german,current.sys_id); })(current, previous);

image

View original source

https://www.servicenow.com/community/itsm-articles/multilingual-for-a-group-notifications-watch-list/ta-p/2301412