Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get the extended table names in a script?

gokulraj
Giga Expert

Hi Team,

I want to get the all extended table names by passing a table name.

Example:"Incident,Problem,Change Request "these tables Extends the table name called Task.If I pass the Task Table I have to Populate those three tables "I...

Regards,

Gokulkraj

7 REPLIES 7

Pranay Tiwari
Kilo Guru

If you phase any issue then it will help you.

 

 

 

 

 

 

Mark correct or helpful if it helps you.

 

Warm Regards,

Pranay Tiwari

| www.DxSherpa.com |

Lyle Taylor
Tera Expert

You can use TableUtils to get all tables that eventually extend a base table:

https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_TU-getTableExtensions 

Luke Van Epen
Tera Guru

The instanceOf method works for this:

 

var incGR = new GlideRecord('incident');
var ritmGR = new GlideRecord('sc_req_item');

gs.info(incGR.instanceOf('task')); //true
gs.info(ritmGR.instanceOf('task')); //true
gs.info(incGR.instanceOf('incident'));//true
gs.info(incGR.instanceOf('sc_req_item'));//false