Task assignment - Catalog item

Jai2021
Tera Contributor

Hi all, 
I have a rquirement that the generated task for a catalog item should be assigned to the respective assignment group based on the choice selection in the generic workflow.
I have chosen to rite script in the catalog mapping section of the catalog item. But it's not working as expected.could anyone help me.

Choices and it's values are  1.A - aa , 2. B -bb 3. C - cc

Assignment group A grp, B grp and C grp
My code:

var choice = current.variables.choices;

if(choice == 'A'){

task.assignment_group = 'sys_id of the group';}like for B and C as well.

Thanks! 

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

are you sure variable name and choice value is correct?

I believe it should be like this i.e. you should compare with aa, bb, cc since you mentioned that's the choice value

var choice = current.variables.choices;

if(choice == 'aa')
	task.assignment_group = 'sys_id of the group1';
else if(choice == 'bb')
	task.assignment_group = 'sys_id of the group2';
else if(choice == 'cc')
	task.assignment_group = 'sys_id of the group3';

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Abirami Thirumoorthi 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader