Multilingual for a Group Notifications – Watch_list
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:
- I18N: Internationalization
- i18 for german language.
- I18N: Internationalization
- 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
Again the same thing for English notification:
Name: notification.english, table: Incident
- 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.
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.
- Finally we create the business rule in the incident table to trigger those events notifications as below:
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); |
|---|
https://www.servicenow.com/community/itsm-articles/multilingual-for-a-group-notifications-watch-list/ta-p/2301412
