Core Concepts
What is a sys_id in ServiceNow?
The question
What is a sys_id in ServiceNow? Why is it important, and where will you encounter it?
Reading Between the Lines
This seems like a basic question, but it reveals whether you understand ServiceNow's data model at a fundamental level. sys_id is everywhere in ServiceNow, and misunderstanding it causes real bugs.
The Answer
A sys_id is a 32-character globally unique identifier (GUID) automatically assigned to every record in every table in ServiceNow. It's the primary key — the one field that uniquely identifies a record across the entire instance.
// Example sys_id: // 6816f79cc0a8016401c5a33be04be441 // // Every record has one: // Incident INC0010001 → sys_id: 5137153cc611227c000bbd1bd8cd2005 // User 'John Smith' → sys_id: 6816f79cc0a8016401c5a33be04be441 // Business Rule 'Set Priority' → sys_id: a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6
Why It Matters
- Reference fields use sys_id: When an incident has a 'Caller' field pointing to John Smith, the database stores John's sys_id (not his name). The display name is resolved at render time.
- APIs use sys_id: REST API calls reference records by sys_id.
GET /api/now/table/incident/5137153cc611227c000bbd1bd8cd2005 - Scripts use sys_id:
gr.get('5137153cc611227c000bbd1bd8cd2005')fetches a specific record.gr.getValue('caller_id')returns a sys_id, not a name. - URLs contain sys_id: When you open an incident form, the URL includes
sys_id=5137153cc611227c000bbd1bd8cd2005.
Common Mistakes
// MISTAKE 1: Comparing display value instead of sys_id
if (current.caller_id == 'John Smith') // WRONG — comparing GlideElement to string
if (current.getValue('caller_id') == '6816f79cc0a8016401c5a33be04be441') // CORRECT
// MISTAKE 2: Hardcoding sys_ids across instances
// sys_ids are PRESERVED during instance cloning.
// However, records created independently on separate instances
// (e.g., a Business Rule built by hand in dev and separately in prod)
// will have different sys_ids.
// Never hardcode sys_ids — use queries or system properties instead.
// CORRECT approach: Query by a stable identifier
var gr = new GlideRecord('sys_user');
gr.addQuery('user_name', 'john.smith'); // Stable across instances
gr.query();
if (gr.next()) {
var userId = gr.sys_id; // Now use this dynamically
}💡 Interview Tip
If asked 'What does getValue() return for a reference field?' — always say the sys_id. If you want the display name, use getDisplayValue(). This distinction comes up in almost every technical ServiceNow interview.