GlideRecord query for specific inherited/child tables
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2012 01:42 PM
is there a way to query tables to exclude certain child tables?
for instance, i would like to query the task table and leave out planned_tasks. This way i can get all incidents, changes, problems, facilities, etc. etc without also grabbing projects, project tasks, etc. etc.
var tasks = new GlideRecord("task");
task.addQuery("actual_table_name", "ISNOT", "planned_task");
task.query();
If i can't do that then how would i get the TaskStateUtil instance of the actual table and not task? if i do a query on the task table i can get all kinds of different things, incidents, projects, project tasks. etc. etc. but when i load up the task state util for any of them all i get is the states for task no matter what overrides i have defined.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2012 01:54 PM
Check below link, it explains it very well.
http://www.servicenowguru.com/scripting/gliderecord-query-cheat-sheet/
ND
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2012 02:20 PM
i see that there is an INSTANCEOF operator. is there a way to NOT that? i am looking for all tasks that are NOT planned_tasks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2012 03:28 PM
use != for this purpose.Like
var tasks = new GlideRecord("task");
task.addQuery("actual_table_name", '!=', 'planned_task');
task.query();
ND
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2012 10:08 AM
my code was just pesudo code. "actual_table_name" is not a column anywhere.
I am really asking if it is even possible to query table heirarchy.