You are currently viewing All About sysID – ServiceNow Fundamentals

All About sysID – ServiceNow Fundamentals

A sys_id is fundamental to the ServiceNow system, which plays an important role in maintaining system integrity. In this article, I am revealing all the facts, uses & properties of sysID.

Do let me know your feedback in the comments section.

[youtube-feed feed=1][youtube-feed feed=3][youtube-feed feed=4]
My ServiceNow YouTube Channels

What is a sys_id?

A unique 32-character GUID (Globally Unique ID), called a Sys ID (sys_id) identifies each record in an instance.

Who manages sys_id operations?

The Now Platform and database should manage all operations on sys_id values.

Can two different instances of different clients have the same sys_id?

The same sys_id value is never generated twice, which ensures that every record created in every table in every instance in the world has a unique identifier.

What is the sys_id of the new record?

A new record has a sys_id of -1, and once inserted, it is assigned a new sys_id.

Can we show sys_id on the form?

The sys_id is not meant to show as a field on a form or as a column in a list. However, it is possible – Click Here

Is it anyhow possible that two sys_ids are the same?

If two records have the same sys_id value, it occurs as a result of the following situations:

  • If a record with the sys_id was copied to the other at the database level outside of the Now Platform.
  • If a record with the sys_id was copied using an Update Set or via XML, its sys_id is the same.

What is an orphan/invalid references sys_id?

This situation arises when the referenced record is deleted but somehow the sys_id of the record is still there. We face such issues when you upload data into a table from outside, or in the case of Glide List.

How can we get the sys_id of the record?

There are multiple ways:-

  • From record URL
https://dev95794.service-now.com/incident.do?sys_id=df782326079111105ff1f9fc7c1ed02b
  • Server Side Script
var sysID = current.sys_id;
  • Client Side Script
var sysID = g_form.getUniqueValue();
  • Export sys_id from the list view – Add “&CSV&sysparm_default_export_fields=all ” at the end of url
https://dev95794.service-now.com/incident_list.do?sysparm_userpref_module=b55fbec4c0a800090088e83d7ff500de&CSV&sysparm_default_export_fields=all
  • Retrieve sys_id using Background Script
getSysID();
function getSysID(){
var grSys = new GlideRecord('incident');
grSys.query();
while (grSys .next()){
gs.print('Number: '+grSys.number+ ', Sys ID: ' +grSys.sys_id);
}
}

//Output
*** Script: Number: INC0000060, Sys ID: 1c741bd70b2322007518478d83673af3
*** Script: Number: INC0009002, Sys ID: 1c832706732023002728660c4cf6a7b9
*** Script: Number: INC0000009, Sys ID: 46b66a40a9fe198101f243dfbc79033d
*** Script: Number: INC0000010, Sys ID: 46b9490da9fe1981003c938dab89bda3
*** Script: Number: INC0000011, Sys ID: 46c03489a9fe19810148cd5b8cbf501e
*** Script: Number: INC0000012, Sys ID: 46c88ac1a9fe1981014de1c831fbcf6d
*** Script: Number: INC0000013, Sys ID: 46cebb88a9fe198101aee93734f9768b
*** Script: Number: INC0000014, Sys ID: 46e18c0fa9fe19810066a0083f76bd56
*** Script: Number: INC0000021, Sys ID: 46ee0924a9fe198100f1cf78c198454a

Leave a Reply