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

Auto assigning groups based off category / subcategory

brown9394
Tera Expert

Hello experts,

I need to auto assign 'assignment_group' based off category/subcategory selection on Incident. I took the assignment rule script approach but I think it does not work on change. The idea is to be able to assign/reassign category/subcategory at any given point and the assignment_group should change accordingly to notify proper team. The only thing I can think of doing business rules, but I have a lot of different group assignments based on category/subcategory, so did not want to create a lot of different business rules. What would be the best way to approach this?

6 REPLIES 6

Aditya Mallik
ServiceNow Employee
ServiceNow Employee

James,



You can use either of the following options:



1. Assignment Lookup Rules


2. Assignment Rules



You will find these under "System Policy -> Rules" menu.


Each one has its own usage and advantages. Assignment Lookup Rules also provide the flexibility where you can decide to run the rules always on every update or only when "Assignment Group" field is empty (ie only for first time assignment).



You can find relevant documentation here:



Assignment rules module


Assignment module rule


Create data lookup rules



Thanks.


Bharath40
Giga Guru

Hi,



You can onChange client script on category field , which looks like below



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


  if (isLoading){



  return;


  }


  if(newValue === ''){


  g_form.setValue('assignment_group','');


  }


  if(newValue=='request'){


  g_form.setValue('assignment_group','sys_id of the group');


  }


  if(newValue=='inquiry'){


  g_form.setValue('assignment_group','sys_id of the group');


  }


}



Thanks,


Please Hit like, Helpful or Correct if your question is answered.


I would prefer write a Script inlude and call that in   BR..later on if any categories or sub categories added. You can change the logic in script include



//Category approvals


  setCategoryApprovals: function(current)


  {



  if(!gs.nil(current.category))


  {


  if (current.category == 'abc') {


  current.assignment_group=//sys_id of   grp A



  }


  else if (current.category == 'def' || current.category == 'xyz'   ) {


current.assignment_group=;//sys_id of   grp B


  }


  }


 


  },


Regards
Harish

Chandresh
Tera Guru

Hi James,



there are couple of questions first:


1. Do you have any custom table where you have created the combination of category, subcategory and group


2. Do you want to assign specific assignment groups on the basis of category and subacategory.



On second condition


If you want to change specific assignment group on submission of the form on the basis of cats and subcats then go with Business Rule or assignment rules.


Defining Assignment Rules - ServiceNow Wiki


Screen Shot 2014-09-16 at 3.20.21 PM.JPG



On first condition


If you have a custom table and   want to change the assignment group the moment you change the category and subcategory combination then go with the combination of Script include and client script. on that custom table.