Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Business rule for enable notification on Emergency change

sureshpcse
Tera Contributor

Need help define business rule to enable a email notification to Technology Approver , Business approver, Major Incident Manager(MIM) and Change owner on emergency changes when Emergency change moves from implement to Review state.

4 REPLIES 4

Bhavya11
Kilo Patron
Kilo Patron

Hi @sureshpcse ,

create 

Business Rule:

Name: Notify on Emergency Change State Transition

table :change_request

Advanced:true

when: after update :true

filter condition :

Bhavya11_0-1721984339681.png

 

 

Script:

var userList = [];

  /*push all differnet user sysid to userList array like 
  if that present in change form do like current.getValue('change_owner'); 
  and psuh like userList.push(current.getValue('change_owner') + "");
  if everytime Technology Approver , Business approver, Major Incident Manager(MIM) and Change owner  are same then put system properites fetch form there
*/

var ids= gs.getProperty("sys_id_of_All_owner");
ids=ids.split(',');
for(var i=0 ;i<ids.length;i++){
	userList.push(ids[i]+'');
}
gs.eventQueue("EVENT-NAME", current, userList.toString());

 

Thanks,

BK

 

 

Hi, 

Thanks for the solution. Can you please help on to get Major Incident Manager from different table.

Can i push Technology Approver, Business approver like Change Owner. And those things added to the eventQueue.

userList.push(current.getValue('u_change_owner') + "");
userList.push(current.getValue('u_asset_tech_owner_approval') + "");
userList.push(current.getValue('u_impacted_service_manager') + "");

 

gs.eventQueue('eventname', current, userList.toString());

Bhavya11
Kilo Patron
Kilo Patron

Hi @sureshpcse ,

 

For bring Major Incident Manager  information in Change you should have at least link between that change and Major incident.

 

you can try something like this 

 

var userList = [];

  /*push all differnet user sysid to userList array like 
  if that present in change form do like current.getValue('change_owner'); 
  and psuh like userList.push(current.getValue('change_owner') + "");
  if everytime Technology Approver , Business approver, Major Incident Manager(MIM) and Change owner  are same then put system properites fetch form there
*/

var ids= gs.getProperty("sys_id_of_All_owner");
ids=ids.split(',');
for(var i=0 ;i<ids.length;i++){
	userList.push(ids[i]+'');
}
//trying to fectch major inicdent manager
/* here i took the example assign to of major incident is itself is MIM*/

var grlistsys = [];
var gr = new GlideRecord("incident");
gr.addQuery("rfc", "c038f10d93530210260bb2ddfaba1021");
gr.addQuery("major_incident_state", "accepted");
gr.query();
while (gr.next()) {
    grlistsys.push(gr.getValue('assigned_to'));
}

// Concatenate userList and grlistsys correctly
var combinedList = userList.concat(grlistsys);
gs.eventQueue("EVENT-NAME", current, combinedList .toString());

 

 

If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful."