Assign task to catalog item dynamically

caliban
Tera Expert

I'm looking to assign the tasks for a Catalog item based on what information is submitted via the portal.

For example if a location select box is on the Catalog item with East Coast, West Coast and Central, I would like the Catalog task on the RITM to be generated correctly for the right group that will be carrying out the work.

I had a look at the documentation on Scripted Tasks that suggests this might be what I'm looking for, but does anyone have any examples of code or how to do this?

Thanks

 

7 REPLIES 7

Hello

I'll make some test in my dev instances and answer you asap

 

Ariel

Hello

Look at "my lab's tests".

I did create a simple workflow to create a SCTask without assignment group defined.

find_real_file.png

No "fixed" assignment made.

find_real_file.png

 

Only "populate" the SCTask's location field

find_real_file.png


When create a request with this SC Item the SCtask was created with empty assignment group.

find_real_file.png

Then, I did create a "assignment" to the sc_task table with this filter.

find_real_file.png

find_real_file.png

 

When create a new request with the "assignment" active, the SCTask was assigned to the assignment group

find_real_file.png

 

I hope my answer has been useful
Ariel
PS: Please mark my answer correct or helpful if I have helped you. Thanks

gtk
Mega Sage

you can create a table with fields and name table as "location routing"

find_real_file.png

 

then in the workflow of catalog task -> script part add this code


var gr = new GlideRecord('table_name');
gr.addQuery('u_catalog_item', current.cat_item);
gr.addQuery('u_location_id', l_id);
gr.query();
while(gr.next())
{

task.assignement_group = gr.u_assignemnt_group;

}

it will applies to multiple catalog item swith multiple groups based on locations