Set assigned_to to opened_by on a Catalog Task


I have a Catalog Task in my workflow. I'd like to set this tasks 'assigned_to' field, equal to the Request Items 'opened_by' user.

Here is what I am currently trying, without luck. Any thoughts are appreciated:

var req = new GlideRecord('sc_req_item');//look at the Request Item
req.addQuery('parent',current.sys_id);
req.query();
task.assigned_to = req.opened_by;//take the assigned to and set it to the Request Item's 'opened_by' field


Thanks!

That works well. Now I suppose I should also set the assignment group to match the 'opened_by' users assignment group. I tried this, but it's not quite working:

task.assignment_group = current.assignment_group;

That line of code would work

That line of code would work if the request item record has an assignment group filled in. If you're looking to get a default assignment group you'll need to query for that somehow. ServiceNow doesn't include the concept of a default assignment group, so if you do have that concept, it's likely specific to your setup.

__________________

Mark Stanger | Cofounder/Chief Architect
CrossFuze
SNCGuru.com
Follow me on Twitter
SNCGuru Facebook Page
Linkedin Profile

Contact Us to discuss how we can help make your ServiceNow project a success!

ServiceNow Partner

If the task is being

If the task is being generated from a workflow running on the request item table you should just be able to do this...

task.assigned_to = current.opened_by;

__________________

Mark Stanger | Cofounder/Chief Architect
CrossFuze
SNCGuru.com
Follow me on Twitter
SNCGuru Facebook Page
Linkedin Profile

Contact Us to discuss how we can help make your ServiceNow project a success!

ServiceNow Partner

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.