How do I set assignment group for a catalog task in the workflow?

sburke
Kilo Explorer

I have a requested item for application access that I want to automatically assign to the correct assignment group.   There are 50+ possible applications, so I created a separate lookup table (u_security_request) with the fields u_security_request_application (name of the application) and a reference field to task.assignment_group.   In the workflow, I create a task that I want to look up to this table and assign to the respective assignment group.   I have tried using various scripts on the task in the workflow that others have posted, but not having any success.   Also, is this the best way to accomplish this?

7 REPLIES 7

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Shari,



How does the catalog item tie to the lookup table? Is there a variable where they're selecting one of the 50 applications or do you have 50 catalog items?


sburke
Kilo Explorer

I have a lookup multiple choice variable set that looks up the application (u_security_request_application) in the u_security_request table.   So the user will see the 50+ possible choices and can select from the list.   It is my first attempt at a catalog item after many hours on wiki and community so I am not sure if I am approaching it correctly?   Thanks you for any help!!


Try code like below.



var tsk = new GlideRecord('Table where you inserting');


  tsk.initialize();



var gr = new GlideRecord('u_security_request');


gr.addQuery('u_security_request_application', g_form.getReference('your filed name'));


gr.query();


task.assignment_grp = gr.assignemt_group;



  tsk.insert();


Brad Tilton
ServiceNow Employee
ServiceNow Employee

If you're using a lookup reference I think you should be able to do something like the following in the script field on the task activity in the workflow:



task.assignment_group = current.variables.multiplechoicevariablename.u_assignment_group;



If you're using a reference field you can dot walk the tables pretty easily. If this is just a multiple choice field then you'd have to do a more complex gliderecord query.