find child of current table
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 02:24 AM
Hi,
I have this function: current.getTableName() for find the name of the current table but I would like to find the child of the current table (inherited table);
so what function should I use to get the child ?
Thanks in advance
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 03:17 AM
Hi @tyffanie_rbr ,
Hope you are doing well.
I am not sure if we any function to get child table names but we can below script to get desired result.
var childTable = [];
var table = current.getTableName();
gs.addErrorMessage(current.getTableName());
var getChildTable = new GlideRecord("sys_db_object");
getChildTable.addEncodedQuery("super_class.label="+table);
getChildTable.query();
while(getChildTable.next()){
childTable.push(getChildTable.name);
}
gs.log(childTable.toString());
Please mark this response as correct or helpful if it assisted you with your question.
Regards,
Harshal