How to set / script an assignment group on sctask based on Catalog Item variable

jmonnette
Giga Contributor

We have a "New Hire Request" catalog item.

We have multiple help desk groups.

We would like to assign a specific help desk group based on the location variable in the catalog item.

Any help on this would be awesome!

Thanks

 

1 ACCEPTED SOLUTION

If you use "getDisplayValue()", the correct script will be:

if (current.variables.nh_location.getDisplayValue() == 'name_location1') {
task.assignment_group = 'sys_id_group1';
if (current.variables.nh_location.getDisplayValue() == 'name_location1') {
task.assignment_group = 'sys_id_group2';
}

 

If without "getDisplayValue()", correct  script:


if (current.variables.nh_location == 'sys_id_location1') {
task.assignment_group = 'sys_id_group1';
} else if (current.variables.nh_location == 'sys_id_location2') {
task.assignment_group = 'sys_id_group2';
}

if multiple locations equal a certain helpdesk, your can be used operator "OR" -||


Example:


if (current.variables.nh_location == 'sys_id_location1' || current.variables.nh_location == 'sys_id_location2') {
task.assignment_group = 'sys_id_group1';
} else if (current.variables.nh_location == 'sys_id_location3' || current.variables.nh_location == 'sys_id_location4' || current.variables.nh_location == 'sys_id_location5') {
task.assignment_group = 'sys_id_group2';
}

Or there are many combinations, use switch case or create a table of group and location mappings, and select the required group when accessing this table by location

View solution in original post

8 REPLIES 8

If you use "getDisplayValue()", the correct script will be:

if (current.variables.nh_location.getDisplayValue() == 'name_location1') {
task.assignment_group = 'sys_id_group1';
if (current.variables.nh_location.getDisplayValue() == 'name_location1') {
task.assignment_group = 'sys_id_group2';
}

 

If without "getDisplayValue()", correct  script:


if (current.variables.nh_location == 'sys_id_location1') {
task.assignment_group = 'sys_id_group1';
} else if (current.variables.nh_location == 'sys_id_location2') {
task.assignment_group = 'sys_id_group2';
}

if multiple locations equal a certain helpdesk, your can be used operator "OR" -||


Example:


if (current.variables.nh_location == 'sys_id_location1' || current.variables.nh_location == 'sys_id_location2') {
task.assignment_group = 'sys_id_group1';
} else if (current.variables.nh_location == 'sys_id_location3' || current.variables.nh_location == 'sys_id_location4' || current.variables.nh_location == 'sys_id_location5') {
task.assignment_group = 'sys_id_group2';
}

Or there are many combinations, use switch case or create a table of group and location mappings, and select the required group when accessing this table by location

Viktor that worked perfectly on the worflow sctasks!! Thank you!!!! quick question would it be better to create a business rule for each catalog item or better to write in the script in the workflow sctasks?

Coleton
Kilo Guru

If these groups aren't changing, you could create a custom table to hold two specified fields: Assignment Group, Location. Then, based off whatever the user picks in the dropdown, query that table and grab the assignment group based off the location chosen.

Coleton thanks for the reply!!

That sounds really cool - any articles on how to do that?