business rule to set up priority

Marcin Witosla1
Tera Expert

Hello ,

i need to write a business rue script to set up a priority on incident table.When business service is

'Email' set up urgency and 

 impact to 1 and when is 'Bond Trading' set up impact and urgency to 2. What the script will look like?

Should i choose before business rule on insert or update?

1 ACCEPTED SOLUTION
9 REPLIES 9

Marcin Witosla1
Tera Expert

Is there any way to do it via before Business Rule script??

Condition should be

find_real_file.png

 

 

 

and script should be

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

	if(current.business_service.changesTo('27d32778c0a8000b00db970eeaa60f16')) //email
	{
		current.impact=1;
		current.urgency=1;
	}
	else//Bond Trading
	{
		current.impact=2;
		current.urgency=2;
	}

})(current, previous);

dvp
Mega Sage
Mega Sage

Here is the sample BR script

if(current.cmdb_ci.name == 'NAME_OF_BUSINESS_SERVICE'){
	current.impact = 1;
	current.urgency = 1;
}
else if(current.cmdb_ci.name == 'NAME_OF_BUSINESS_SERVICE'){
	current.impact = 2;
	current.urgency = 2;
}

Ramesh R
Tera Contributor

Hello,

 

You can do with before business rule by using below code: Take Incident table with insert or update as per your requirement.

 

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


if(current.business_service.name == 'Email'){
current.impact = 1;
current.urgency = 1;
}
else if(current.business_service.name == 'Bond Trading'){
current.impact = 2;
current.urgency = 2;
}

})(current, previous);

 

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.


Thanks
ramesh

Masarrat Siddi1
Kilo Guru

Please follow below steps

 

1 Create a business rule and define the condition

 

find_real_file.png

 

2 Set the value, there is no coding required!!

 

find_real_file.png

 

 

 

Thanks!!