- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 07:31 AM
Hi all,
I have a script where I want to check if a table name that was given as a parameter is extended from the Task table or not. If it *is* the Task table, that should also be fine. If the table name does not correspond to a Task table, the script won't work so we need to return an error.
A few people have written about the API GlideTableDescriptor which sounded promising, but there appears to be no documentation on this API whatsoever so I'm at a loss.
Regards,
Kim
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 01:10 PM
There is a script include OOB that allows you to get the base table, for you this should be task if you pass in a table value.
new TableUtils("param_table_name").getAbsoluteBase()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 07:56 AM - edited 02-26-2025 08:24 AM
Have you tried GlideTableHierarchy?
e.g.
var table = new GlideTableHierarchy("task");
gs.info(table.getAllExtensions());
that would return all tables extended from task (note including the task table itself) e.g.
task,sc_task,problem_task,change_phase,sc_req_item,kb_submission, release_phase,problem,ticket,sm_task,hr_task,change_task,change_request, change_request_imac,incident,release_task,vtb_task,sm_order,hr_case, sysapproval_group,sc_request
Just feed the table.getAllExtensions() into an array and check for the table you want to validate.
the getAllExtensions method is part of the TableUtils API.
Regards
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 08:51 AM - edited 02-28-2025 07:11 AM
Hi @kim-lindgren ,
You can query on Tables table and check if given table's super class is Task table, and based on return true or false you can apply the next business process.
You can covernt this code, in generic function.
var sysDBObject = new GlideRecord('sys_db_object');
sysDBObject.addQuery('name', 'incident'); // replace the table name via dynamic parameter
sysDBObject.addQuery('super_class.name','Task');
sysDBObject.query();
gs.print(sysDBObject.hasNext());
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 01:10 PM
There is a script include OOB that allows you to get the base table, for you this should be task if you pass in a table value.
new TableUtils("param_table_name").getAbsoluteBase()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 12:18 AM
Thank you all for your suggestions!
I ended up going with Kieran's solution because I find it the simplest one, but the other methods you have described are helpful too. It's nice to see that there are so many different ways to go about this.
Regards,
Kim