The CreatorCon Call for Content is officially open! Get started here.

Help with assignmend group logic on incident

JohnDF
Mega Sage

Hi everyone,

 

I have a queston. How you would achieve that requirement?

 

Given: An Agent of the Incident want to change the assignment group to 2nd Level Support but there need to be a logic that the assignmend group should set the assignmend group automatically after save to for example group Options because on the incident is a field populated called Service Divsion with the value Option. 

What would be the best solution in servicenow to do this?
And additonal the user in the assignmend group should only see the incident where the field on incident Service Divison is populated with Option.
This should be applicable for other groups in the same logic like this too.

Thanks for any input and help.

4 REPLIES 4

Bert_c1
Kilo Patron

The 'service_offering' has 5 fields that reference the sys_user_group table. You can write a business rule for incident that runs on Insert/Update and has script logic to look up the service_offering record and set incident.assignment_group to any of the 5 fields on the service_offering table:

 

assignment_group
change_control
managed_by_group
support_group
user_group

 

Screenshot 2023-11-11 142417.png

Script for Advanced tab:

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

	// Add your code here
	var svcOffering = new GlideRecord('service_offering');
	svcOffering.addQuery('sys_id', current.service_offering);
	svcOffering.query();
	if (svcOffering.next()) {
		current.assignment_group = svcOffering.assignment_group;
		/* Other group fields
		change_control
		managed_by_group
		support_group
		user_group
		*/
		gs.addInfoMessage('Setting assignment group to ' + svcOffering.name + ' assignment group');
	}

})(current, previous);

 

If the above is not what you're looking for, be specific with table and column names for what you have in bold text.

 

Your second requirement can be met with a "Query" business rule with script logic to include incident records where you say "Service Divison is populated with Option."

For your first requirement write a before business rule at order 20000 so that it will run at the last before insert otherwise there is a chance that other rules might be pitched in and override your logic.

 

try{
var assignment_group;
if(current.service_offering.assignment_group){
   assignment_group = current.service_offering.assignment_group;
}else if(current.service_offering.change_control && !assignment_group){
  assignment_group = current.service_offering.change_control;
}else if(current.service_offering.managed_by_group && !assignment_group){
  assignment_group = current.service_offering.managed_by_group;
}else if(current.service_offering.support_group && !assignment_group){
  assignment_group = current.service_offering.support_group;
}else if(current.service_offering.user_group && !assignment_group){
  assignment_group = current.service_offering.user_group;
}
if(assignmnet_group){
 current.assignment_group = assignment_group;
}
} catch(e){
gs.error('something went wrong in setting the assignment group from service offering');
}

 

Didn't got your second requirement, can you please give more description.

JohnDF
Mega Sage

Hi both,

 

thanks for reply. I don't get the service_offering part?


Here is a screenshot, its just based on case, but inicent is same.

JohnDF_0-1699779374953.png

The Agent select 2ndLevel Support assingment group, becasue he cant see other groups. But know when he save or insert the record the assignmend group should change to  Option becasue the field Service Devition has the value OPTIONS.

This is just an example as I mentioned "This should be applicable for other groups in the same logic like this too."

And the second requirement is not coverred.

"And additonal the user in the assignmend group should only see the incident where the field on incident Service Divison is populated with Option."


Im not the expert, but is the first requirmenet not via decision table and builder working? 

 

THanks for help.

A simpler business rule, no scripting

Screenshot 2023-11-12 144520.png

Actions tab:

Screenshot 2023-11-12 144537.png

for the sn_customerservice_case table. Create a second business rule and update the Filter condition in the first screenshot.