- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
There are two scripts (option 1 & 2) that can be used to get information about table relationships and all tables that extend the current table.
However, if you use ServiceNow GlideTableHierarchy API's getAllExtensions() methods in option 2 script, you can get the same information with fewer codes rather than the complex codes in option 1 script
Correction for the image:
Option 1 is
var parentName = 'sn_hr_core_case';
getExtendedChildedTableName(parentName);
function getExtendedChildedTableName(parentName) {
var grDBObject = new GlideRecord('sys_db_object');
grDBObject.addQuery('super_class.name', parentName);
grDBObject.query();
while (grDBObject.next()) {
gs.print(grDBObject.name);
}}
Output:
*** Script: sn_hr_core_case_workforce_admin
*** Script: sn_hr_core_case_talent_management
*** Script: sn_hr_core_case_payroll
*** Script: sn_hr_core_case_total_rewards
*** Script: sn_hr_core_case_operations
*** Script: sn_hr_core_case_corporate_communication
*** Script: sn_hr_core_case_benefits
*** Script: sn_hr_core_case_global_mobility
*** Script: sn_hr_core_case_compensation
Option 2 is
var table = new GlideTableHierarchy();
gs.info(table.getAllExtensions());
If my content helped you in anyway, please mark this content as BOOKMARK, SUBSCRIBE & HELPFUL
Best Regards,
Prashant Kumar (LearnIT)
YouTube Channel LearnIT: https://www.youtube.com/@learnitwithprashant
Blog LearnIT: https://medium.com/@LearnITbyPrashant
Prashant Kumar LinkedIn: https://www.linkedin.com/in/learnitbyprashant/
ServiceNow Community Prashant Kumar - https://www.servicenow.com/community/user/viewprofilepage/user-id/19635
- 1,006 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
