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

Automatically populate assignment group from configuration item on incident

jonny1
Giga Contributor

I am trying to get the assignment group field on an incident to automatically populate based on the given configuration item. I know this has been repeatedly asked and there's documentation on it but I am new to service now and I'm failing to have any success. I'd really appreciate a descriptive walk through on how to do it.

1 ACCEPTED SOLUTION

manikorada
ServiceNow Employee
ServiceNow Employee

Jonny,



Create a Client script like this:


Name : Populate assignment Group


Type : onChange


Field Name : cmdb_ci


Script:



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


    if (isLoading || newValue === '')


          return;


  var ref = g_form.getReference('cmdb_ci');


g_form.setValue('assignmnet_group', ref.support_group); // support_group is the name of the field on cmdb from which you want to get the group


}


View solution in original post

11 REPLIES 11

manikorada
ServiceNow Employee
ServiceNow Employee

Jonny,



Create a Client script like this:


Name : Populate assignment Group


Type : onChange


Field Name : cmdb_ci


Script:



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


    if (isLoading || newValue === '')


          return;


  var ref = g_form.getReference('cmdb_ci');


g_form.setValue('assignmnet_group', ref.support_group); // support_group is the name of the field on cmdb from which you want to get the group


}


Works beautifully. Thanks Mani!


I know this is an old post now, but a better practice for this would be to use a callback to make the server call asynchronous. 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}

    //Get the Support Group from the CI and populate Assignment Group if Support Group is populated
    g_form.getReference('cmdb_ci',getSupportGroup);
}

function getSupportGroup(ci) {
    if (ci.support_group) g_form.setValue('assignment_group', ci.support_group);
}

Miriam Berg
Kilo Guru

Hi Jonny,



Maybe this could help you?


Automatically assign a CI Support Group to a ticket using Business Rules - ServiceNow Express Suppor...


It's pretty detailed with step-by-step instructions.


Good luck!



Best regards,


Miriam