Details of Sys_Id

Dev M
Tera Contributor

I have only Sys_Id. How to get its details where it belongs to like which Table, Record, Etc.
I tried is by using a script in the Scripts Background but couldn't get the details. What is the best practice to do so.

16 REPLIES 16

tiagomacul
Giga Sage

1. Use Global Search (if enabled)

Paste the sys_id directly into the global search bar. If the record exists and your instance is configured to index sys_ids, it might show up.

 

2. Code Search

https://<yout instance>.service-now.com/now/nav/ui/classic/params/target/sys_ui_page.do%3Fsys_id%3D8bc77fb2d7120200b6bddb0c825203ac%26sysparm_record_target%3Dsys_ui_page%26sysparm_record_row%3D1%26sysparm_record_rows%3D4%26sysparm_record_list%3DnameCONTAINScode%255EORDERBYname

 

3. Script in Background (with a twist)

Try this script in the Scripts - Background module:

var gr = new GlideRecord('sys_db_object');
gr.query();
while (gr.next()) {
  var table = gr.name.toString();
  var rec = new GlideRecord(table);
  if (rec.get('sys_id', 'your_sys_id_here')) {
    gs.print('Found in table: ' + table);
    gs.print('Record: ' + rec.getDisplayValue());
    break;
  }
}

This loops through all tables and tries to find a match. It can be slow, but it’s thorough.

Not recommended to run in production without prior validation.

 

 

.

Dipu Joy
ServiceNow Employee
ServiceNow Employee

Searching through the background script can be challenging, especially if the session lacks access to all necessary scopes. Providing additional context regarding your request can be beneficial, such as specifying whether you expect to locate the item on the instance, within deleted data, or as part of a configuration. If it pertains to a configuration sys_id, you should be able to identify it in the sys_update_xml table, where the payload includes "sys_id" if it originated from another instance/created and deleted. In the case of deleted data, it may be recorded as a document_key within the sys_audit table( it was audited). Additionally, you could attempt to search for the sys_id string within the Transactions module, provided the table has not been rotated, to ascertain the age of the sys_id reference. If dealing with deleted data or records, consider running the Global search Background scripts on your SUBPROD instances, as there is a possibility the data may have been cloned to SUBPROD if it is not present in PROD.