Catalog task is not getting assigned to assignment group automatically- Please help.

girishtahalrama
Giga Contributor

Hello Team,

I was testing one of the catalog item in UAT- I realized that catalog task was not getting assigned to assignment group automatically. Which should not be the case.

As to fix this, I went into the catalog item maintain- found the catalog item- click the workflow- checkout — click on catalog task property — and updated the fulfillment group and click on update. When I tested this again- the catalog task is not getting assigned to assignment group field. this still shows blank,

What am I missing? I followed all the steps please help me out.

Thanks!

43 REPLIES 43

well...due to some reasons our Admin who used to support us has removed this catalog item and I asked them to reload it to UAT so that I can test this.


but I am checking this on UAT.



I can post the script here only and you can troubleshoot instead of getting into my instance.



// Set values for the task in this script.   Use the variable 'task' when setting additional values.


// Note: This script is run after the task values are set using the Fields, Template or Values you have specified.


//


// For example:


//         task.short_description = current.short_description;




task.short_description = current.short_description;


task.description = current.short_description;


task.assignment_group = 'SYSID of group';


// task.assignment_group = getAssignmentGroup();






function getAssignmentGroup(){




  var sb = new GlideRecord('u_routing_rule');


  sb.addQuery('u_catalog_item',current.cat_item);


  sb.addQuery('u_variable_value',current.variable_pool.application);


  sb.addQuery('u_service',current.variable_pool.u_technical_service);


  sb.query();


  if(sb.next()){


  return sb.u_assignment_group;


  }



  /*var group = getGroup();



  if (group != "") {


  return group;


  }


  var assign_to = new GlideRecord('u_workflow_task');


  assign_to.addQuery('u_catalog_item', current.cat_item);


  assign_to.query();



  if (assign_to.next())


  {


  return assign_to.u_assignment_group;


  }


  else


  {


  return gs.getProperty('assignment.group.none');


  }



}




function getGroup() {



  var helper = new USDRoutingEngine();



  var myParameters = {};



  myParameters.u_catalog_item = current.cat_item;


  myParameters.u_variable_value = current.variables.application;


  //myParameters.u_service = current.variables.u_technical_service;


  var rule = helper.getRouting(myParameters, helper.FULFILLMENT_TYPE, '');


  if (rule != '') {


  return rule.u_assignment_group;


  }


  else {



  var myParam = {};



  myParam.u_catalog_item = current.req_item;


  var noLocationRule = helper.getRouting(myParameters, helper.FULFILLMENT_TYPE, '');


  if (noLocationRule != "") {


  gs.log('alternate assignment group found.','Rodney');


  return noLocationRule.u_assignment_group;


  }


  }



  return "";


}


*/


}


Thanks!


Hi Girish,



Just to double check, Did you hardcoded the group sys_id value in below script or was it the same syntax..:)


task.assignment_group = 'SYSID of group';


I did create this syntex:


task.assignment_group = 'SYSID of group';



initially it was showing only



task.short_description = current.short_description;


task.description = current.short_description;


task.assignment_group = getAssignmentGroup();



so, this is the only syntex which I made change.


Girish,



What I mean was replace "SYSID OF GROUP" with exact group sys_id.


Identifying the sys_id Value of a Record - ServiceNow Guru


Sample


Screen Shot 2016-06-17 at 1.53.53 PM.png