- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 07:50 AM
Given a sys_id, how do we find to which record the sys_id belongs to?
Solved! Go to Solution.
- Labels:
-
Upgrades and Patches

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 08:04 AM
You COULD write a script that goes through sys_db_object and checks each table to see if it can find the record. With over 2,000 tables in a default Helsinki instance, this could take a while. The *untested* script might look something like this:
var mySysId = 'xxxxxxxxxxxxxxxxxxxxx'; // put in your sys_id here
var table = new GlideRecord('sys_db_object');
table.query();
while (table.next()) {
var gr = new GlideRecord(table.getValue('name'));
if (gr.get(mySysId)) {
gs.log('it looks like it came from ' + gr.getValue('label'));
break;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 07:52 AM
I would have thought you could look on the task table and create a filter to search for sys_id in question?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 07:59 AM
Out on share there is an app called OneSearch that searches (among other items) sys_id. Perhaps that is what you are looking for?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 08:04 AM
You COULD write a script that goes through sys_db_object and checks each table to see if it can find the record. With over 2,000 tables in a default Helsinki instance, this could take a while. The *untested* script might look something like this:
var mySysId = 'xxxxxxxxxxxxxxxxxxxxx'; // put in your sys_id here
var table = new GlideRecord('sys_db_object');
table.query();
while (table.next()) {
var gr = new GlideRecord(table.getValue('name'));
if (gr.get(mySysId)) {
gs.log('it looks like it came from ' + gr.getValue('label'));
break;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 08:06 AM
yes, Chuck. Even I was thinking about to write this script. Thank you