1284 views

Description

When a user is logged into a domain other than the Global domain and views an incident record, the user can select another domain from the domain picker. However, any email notifications that are sent based on changes to the same incident reflect the choice list values that use the Global domain, not the user-selected domain.

Steps to Reproduce

 

  1. Select a domain other than Global.
  2. Update an incident that fires a notification.

The notification contains information based on the Global domain, not the user-selected domain.

 

Workaround

Use GlideRecord()  to query the sys_choice table via a  <mail_script> to obtain the label that is required in the notification.

In the examples below, it is assumed that there is a choice list label for the domain of the current record. If this is not the case, "undefined" is printed. For example, if current is in Domain "X," but there is/are no sys_choice record(s) for the "impact" field, 

template.print("The current impact is "+myLabel);  

 

will print out "The current impact is undefined". However,

 

${impact}

 

will print out the global choice-list label.

Example specific label:

 <mail_script>  
 var dmn = current.sys_domain;  
 var val = current.impact;  
 var myLabel = Choice(dmn,"impact",val);  
 template.print("The current impact is "+myLabel);  
 function Choice(d,e,v){  
   var query = 'sys_domain='+d+'^element='+e+'^value='+v;  
   var gr = new GlideRecord("sys_choice");  
   gr.addEncodedQuery(query);  
   gr.query();  
   if (gr.next()) return gr.label;  
 }  
 </mail_script>  
The current impact is 1 - High-SW

 

 Example multiple labels: 

 <mail_script>  
 vl = {  
 'priority' : ' ',  
 'category' : ' ',  
 'severity' : ' ',  
 'impact' :' ',  
 'state' :' ',  
 'urgency' : ' '  
 };  
 vl['priority'] = current.priority;  
 vl['category'] = current.category;  
 vl['severity'] = current.severity;  
 vl['impact'] = current.impact  
 vl['state'] = current.state;  
 vl['urgency'] = current.urgency;  
 for ( key in vl){
var myLabel = Choice(current.sys_domain,key,vl[key]);
template.print('The current '+ key+' is '+myLabel);
} function Choice(d,e,v){ var query = 'sys_domain='+d+'^element='+e+'^value='+v; var gr = new GlideRecord("sys_choice"); gr.addEncodedQuery(query); gr.query(); if (gr.next()) return gr.label; } </mail_script>

The current impact is 1 - High-SW
The current category is Network-SW
The current state is Work in Progress-SW
The current priority is 1 - Critical-SW
The current severity is 1 - High-SW
The current urgency is 1 - High-SW

 

 Example dynamic labels:

 <mail_script>  
 vl = {};   
 var grd = new GlideRecord('sys_dictionary');   
 grd.addEncodedQuery('name=incident^ORname=task^choiceISNOTEMPTY^element!=sys_class_name^choice!=0^element!=NULL^element!=short_description^element!=approval');   
 grd.query();   
while (grd.next()) 
{
var val =eval('current.'+grd.element);
if (val) vl[grd.element] = val;
} for ( key in vl) template.print(key+" is "+Choice(current.sys_domain,key,vl[key])+"\n")
function Choice(d,e,v){ var query = 'sys_domain='+d+'^element='+e+'^value='+v; var gr = new GlideRecord("sys_choice"); gr.addEncodedQuery(query); gr.query(); if (gr.next()) return gr.label; } </mail_script>

severity is 1 - High-SW
notify is Do Not Notify-SW
priority is 1 - Critical-SW
incident_state is Active-SW
contact_type is Email-SW
urgency is 1 - High-SW
impact is 1 - High-SW
state is Work in Progress-SW
category is Network-SW


Related Problem: PRB606205

Seen In

Dublin EA 8
Dublin Patch 6
Eureka Patch 11 Hot Fix 2
Eureka Patch 13 Hot Fix 5
Eureka Patch 3 Hot Fix 1
Eureka Patch 4 Hot Fix 1
Eureka Patch 5
Fuji Patch 11
Fuji Patch 3
Geneva Patch 3 Hot Fix 1
Geneva Patch 4

Fixed In

Istanbul
Jakarta

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-04-04 01:44:23
Published:2017-10-02