GlideRecord query for specific inherited/child tables

chazz1
Mega Contributor

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.

6 REPLIES 6

chazz1
Mega Contributor


apparently it is not possible to query table hierarchy.


latinad
Kilo Explorer

You can use the following query...

task.addQuery('number','STARTSWITH','TASK');

Inside the planned_task table (control tab), change the Prefix to something else like PT.

That way it won't show in the query.