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.

How to query assignment group from tasks table?

zsquared
Tera Contributor

Hello,

I am trying to query the assignment_group in my tasks table but I think I am hitting an error due to my lack of understanding the user groups.  

I want to filter for the assignment group called AOM-OU. I tried replacing assignment_group with sys_user_group since I noticed that this was a reference field in the form.

var tasks = new GlideRecord('sc_task');

tasks.addQuery('sys_user_group', 'AOM-OU');

tasks.query();

This should be a simple query but I'm not sure where I am going wrong...

1 ACCEPTED SOLUTION

Deepak Kumar5
Kilo Sage
  1. var tasks = new GlideRecord('sc_task');  
  2. tasks.addQuery('assignment_group', 'sys_ID');   //sys Id of assignment group
  3. tasks.query();

View solution in original post

11 REPLIES 11

Deepak Kumar5
Kilo Sage
  1. var tasks = new GlideRecord('sc_task');  
  2. tasks.addQuery('assignment_group', 'sys_ID');   //sys Id of assignment group
  3. tasks.query();

Hm.. I want all the records within a specific group but there are multiple sys_ids for one specific assignment group.   How do I get the sys_id of the group?


J/K I think I looked at the wrong place for the sys_id!



Thank you!


Hi Zhen,



Could you guide, where did you query the assignment_group in TASK table and used the below code to get the desired result



  1. var tasks = new GlideRecord('sc_task');
  2. tasks.addQuery('assignment_group', 'sys_ID');   //sys Id of assignment group
  3. tasks.query();


Thanks in advance