Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Business Rule not working

ServiceNow Use6
Tera Guru

Hi,

 

I am trying to create a Business Rule for the incident matrix. Priority is not getting changed. Kindly help.

 

(function executeRule(current, previous /*null when async*/) {

	var imp = current.u_impact.getValue();
	var urg = current.u_urgency.getValue();
	//var pri = current.u_priority;

	gs.info('impact is ' + imp + ' urgency is ' + urg);

	if((imp == '1')	 && (urg == '1')){
		current.u_priority = '1';
	}

	else if((imp =='1') && (urg == '2')){
	current.u_priority = '2';
   }

   else if((imp == '1') && (urg == '3')){
	current.u_priority = '3';
   }

   else if((imp == '2') && (urg == '1')){
	current.u_priority= '2';
   }

   else if((imp == '2') && (urg == '2')){
	current.u_priority='3';
   }

   else if((imp == '2') && (urg == '3')){
	current.u_priority='4';
   }

   else if((imp == '3') && (urg == '1')){
	current.u_priority='3';
   }

   else if((imp == '3') && (urg == '2')){
	current.u_priority = '4';
   }

   else if((imp == '3') && (urg == '3')){
	current.u_priority = '5';
   }
	

})(current, previous);
10 REPLIES 10

Ankur Bawiskar
Tera Patron

@ServiceNow Use6 

any reason you are using new u_priority field when there already exists an OOTB field?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader