autopopulate the Assignment group upon updataing the Configuration Item on the Incident Table

alkagupta
Tera Contributor

I need to auto-populate the Assignment group upon updating the Configuration Item on the Incident form only when Support group is active and not null. if CI Support group is empty or Inactive, it should refer to the location service desk. And, if Location service desk is empty, it should assign to a particular group.

 

Using this client script which is not working. Any help would be appreciated.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
var CIsupportg = g_form.getReference('cmdb_ci', doAlert); // doAlert is our callback function
 
function doAlert(CIsupportg) { //reference is passed into callback as first arguments
 
  if (CIsupportg.support_group != "" && CIsupportg.support_group.active == "true") // Verify the field name
{  g_form.setValue('assignment_group', CIsupportg.support_group);  }
else 
{
var app = g_form.getReference('location', callBack);} }    
 
function callBack(app) {
    if (app) {
        if (app.u_service_desk != '') {
            g_form.setValue('assignment_group', app.u_service_desk);
            
        } else {
            var grp = 'ddeeb581111111111666666eaf961965';
            g_form.setValue('assignment_group', grp);
        }
    }
}}
0 REPLIES 0