Finding the sys_id of a record

ServiceNow has the sys_id of fields sort of hidden.  However there are a couple of tricks to get that sys_id field.

ODBC Driver

If you are using the ServiceNow ODBC Driver and a reporting tool, you can pull the sys_id field information easily.  However the inconvenient part is getting the ODBC driver setup.  It is often easier to just use ServiceNow to find sys_ids.

Right Click

You can right click the header bar of most forms and find the sys_id.

To get a sys_id from the header bar:

1. Navigate to the record whose sys_id is required.
2. Right click the header bar and select Copy Sys_id


Since the sys_id of a record is always part of the URL for a link to that record, it is possible to retrieve the sys_id by viewing the URL. For example, an Incident with the following URL:

https://<instance name>

The sys_id is : 23dc968f0a0a3c1900534f399927740e

Also the sys_id can be viewed in the information bar of the browser simply by hovering over a link to the record.

Client side Javascript

Add a onLoad Client Script to show a sys_id

function onLoad() {
var incSysid = g_form.getUniqueValue();

Server Side Javascript

The sys_id value of a record can be found in a business rule (or any other server-side JavaScript) by dot-walking from the GlideRecord:

var id = current.sys_id;

Background Script

The sys_id value of a record can be found in a background script.  Here is an example:

function findCISysID(){
grCI = new GlideRecord('cmdb_ci');
while ({
gs.print('CI Name: ' ', Sys ID: ' +grCI.sys_id);

Export CSV

If you are using the Dublin version of ServiceNow or higher , you can add this URL Parameter to export the sys_id and all fields to CSV


How to use this parameter

1. Navigate to the list of records whose sys_id is required.
2. Build your filter
3. Right click the Filter, and select Copy URL
4. Paste the URL into a new browser window
5. Add &CSV&sysparm_default_export_fields=all to the end of the URL
6. A CSV file with all fields AND the sys_id is exported.

Example URL