Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Add Catalog Task Assigned To from Assignment group reference field

Jose Agudelo
Tera Contributor

I'm trying to populate the assigned to task based on assignment group manager and other custom fields.

JoseAgudelo_0-1732216823160.png

For example, I put that group on the catalog task assigned group field:

JoseAgudelo_1-1732216878647.png

And this is my actual code, but I'm getting several errors when the workflow executes:

JoseAgudelo_2-1732216922393.pngJoseAgudelo_3-1732216930811.png

 

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

You cannot reference in the script the value set in the Fulfillment group field, so clear that field, then your script would look more like:

var group_sysid = '123123jk2j390213121234'; //sys_id of Assignment group
task.assignment_group = group_sysid;
var grp = new GlideRecord('sys_user_group');
if (grp.get(group_sysid)) {
	task.assigned_to = grp.manager;
}

If you want to script the assignment of the Instructions field, use

task.description = 

View solution in original post

2 REPLIES 2

Brad Bowman
Kilo Patron
Kilo Patron

You cannot reference in the script the value set in the Fulfillment group field, so clear that field, then your script would look more like:

var group_sysid = '123123jk2j390213121234'; //sys_id of Assignment group
task.assignment_group = group_sysid;
var grp = new GlideRecord('sys_user_group');
if (grp.get(group_sysid)) {
	task.assigned_to = grp.manager;
}

If you want to script the assignment of the Instructions field, use

task.description = 

Thank you, it's working now

JoseAgudelo_0-1732218080216.png