- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2016 01:20 PM
I have a sys_id value of a table and I want to find out the table associated with that sys_id. Is there any way i can find out the table or record name using the sys_id?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2016 01:48 PM
Hi Sandeep,
Sample script here. Please adjust it as per your need.
var gr = new GlideRecord('sys_db_object');
gr.addQuery('sys_id','YOURSYSID HERE');
gr.query();
while(gr.next())
{
gs.addInfoMessage(gr.name); //This will give you table name
}
Business Rules - ServiceNow Wiki
Business Rules Best Practices - ServiceNow Wiki
You can fire it from Background script for testing purpose. More info here.
Background Scripts — ServiceNow Elite

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2016 02:01 PM
What Sandeep is asking for is, here's a sys_id 03973320c0a801020075d86be149dcbb
What table does the associated record go with? Is it business rule record from sys_script? Is it an incident record from incident? Who knows?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2016 02:04 PM
Got you. Thanks chuck for the update
@Sandeep, I am not sure if the below app will address your question or not, but you can give it a try.
http://www.servicenowguru.com/system-definition/global-script-config-search/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2024 02:47 PM
There is a reference field called profile on a form.
I get a sys_id of profile. Now I want to find the table name for the profile.
I can not pass that to "sys_db_object" because it's the sys_id of the record and not the actual reference table where that record exists.
That's why Chuck is right in saying it will not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2016 06:40 AM
Thanks Pradeep for the script. I was able to retrieve the records based on the sys_id.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2016 06:41 AM
You mean my script is working fine now 🙂