Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

Girish,



In your code line below you need to specify actual sys_id of the group instead of 'SYSID of group'. In order to get Sys_id go to a group right click and select Copy sys_id and paste in your script.



task.assignment_group = 'SYSID of group';


HI Pradeep,



I did the same, Copied and replaced SYSID of group to sys id.



when I checked the same catalog task- it does not show the task is moved to assignment group, Do I need to create another catalog task or it should reflect in the same?  



Also this the below script should remain same:



task.short_description = current.short_description;


task.description = current.short_description;


task.assignment_group = ''; (pasted the sys id number here)


// task.assignment_group = getAssignmentGroup();


Girish,



Create a new one and see if the Assignment group is populated.


Can you copy and paste the code as is here.


// 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 = '55c2958a4f0822006896e3414210c7a5';


// 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 "";


}


*/


}