find child of current table

tyffanie_rbr
Tera Contributor

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

Harshal Aditya
Mega Sage
Mega Sage

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