Script to assign to assign a task to a specific assignment group based on the value of a variable

Cupcake
Mega Guru

I am wondering if you can write a script inside of the task to assign that task to a specific assignment group based on the value of a variable.

Inside of the workflow  - I have a task and I have some script inside of that task because I want the task to go to a specific group based off the value of a variable. The script that I have inside doesn't seem to be working at all. Not exactly sure why?

find_real_file.png

1 ACCEPTED SOLUTION

Dominik Simunek
Tera Guru

As this activity is Catalog Task and your sample code looks like the code to generate Approvals I guess you used wrong syntax for setting the group in Catalog Task activity. If you check "advanced" in Catalog Task, you have a script field that allows you to set any field of task being generated. This is the template I get:

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

so you should put in your if/else statements "task.assignment_group = 'sys_id'" instead of pushing into answer array (which is syntax from Approval activities).

View solution in original post

2 REPLIES 2

Dominik Simunek
Tera Guru

As this activity is Catalog Task and your sample code looks like the code to generate Approvals I guess you used wrong syntax for setting the group in Catalog Task activity. If you check "advanced" in Catalog Task, you have a script field that allows you to set any field of task being generated. This is the template I get:

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

so you should put in your if/else statements "task.assignment_group = 'sys_id'" instead of pushing into answer array (which is syntax from Approval activities).

Thank you Dominic.

 

Much appreciated