🗄️ ServiceNow — Tables, Data Model & Applications
ServiceNow Developer Guide · Digital Kimya
Everything in ServiceNow is a record in a table.
Diagramme interactif — Hiérarchie des tables
x_acme_ sur toutes les tables et scripts.Isolée — ne peut pas appeler du code Global sans permission.
Portable via App Repository ou Update Set.
✅ Recommandé pour tout nouveau développement.
Risque d'effet de bord sur les upgrades.
Difficile à isoler et versionner.
⚠️ À éviter pour les nouveaux développements.
task hierarchy — is the single most important concept for any ServiceNow developer or architect. Get this wrong and your CMDB, reporting, and customisations will fight against the platform instead of with it.
Application Scope — Where Your Code Lives
Every customisation in ServiceNow exists within a scope. The scope determines isolation, access, and portability.
Global Scope
- Default scope for all out-of-the-box (OOB) configurations
- Code in Global can call any other code on the platform
- Customisations in Global are harder to isolate and upgrade-test
- Risk: Global customisations can break on platform upgrades
Scoped Application
- An isolated container for a specific application or feature set
- Has its own tables, scripts, UI components, and access policies
- Cannot call Global-scope scripts without explicit cross-scope access granted
- Prefix applied to all objects: e.g.,
x_myco_hrapp_leave_request - Travels cleanly between instances via Update Sets or the App Repo
Example: ServiceNow HR Service Delivery (sn_hr_core) is a scoped app. Its tables, scripts, and ACLs are isolated from the ITSM modules. A custom integration you build as a scoped app (x_acme_sap_integration) can be exported, versioned, and installed independently.
Global Scope
├── incident (table)
├── change_request (table)
└── Custom Business Rule on incident (OOB style — avoid)
Scoped App: x_acme_hr_portal
├── x_acme_hr_portal_leave_request (table)
├── LeaveApprovalUtils (Script Include, scoped)
└── HR Portal Client ScriptsBest practice: New development should always be in a Scoped App, not Global.
The task Table — Foundation of All ITSM
The task table is the parent table for the entire ITSM platform. It defines the common fields shared by every work item in ServiceNow.
Fields Inherited by All Task Children
| Field | Type | Purpose |
|---|---|---|
number | String (auto) | Human-readable ID (INC0001234) |
short_description | String | One-line summary |
description | String | Full detail |
assigned_to | Reference → sys_user | Individual assignee |
assignment_group | Reference → sys_user_group | Team assignee |
state | Integer (Choice List) | Current status |
priority | Integer (Choice List) | P1–P5 |
opened_at | DateTime | Creation timestamp |
closed_at | DateTime | Closure timestamp |
opened_by | Reference → sys_user | Who created it |
work_notes | Journal | Internal notes |
comments | Journal | Customer-visible notes |
active | Boolean | Is this record open? |
Because all task children inherit these fields, a GlideRecord query on task returns all incidents, changes, requests, and problems — the entire workload of the platform.
The Task Hierarchy
task (parent — abstract)
├── incident ← Incident Management
├── problem ← Problem Management
├── change_request ← Change Management
├── sc_req_item ← Service Catalogue (RITM)
│ └── sc_task ← Catalogue Task (child of RITM)
├── sc_request ← Catalogue Request wrapper
└── cert_follow_on_task ← ... and many moreincident — Extends task
Incident adds fields specific to disruption management:
| Field | Purpose |
|---|---|
caller_id | Who reported the incident |
category | e.g., Network, Software, Hardware |
subcategory | e.g., Connectivity, Crash, Printer |
impact | Business impact (1=High, 3=Low) |
urgency | Speed of resolution needed (1=High, 3=Low) |
resolve_time | Time to resolution (for SLA calculation) |
caused_by_change | Link to the change that caused this incident |
State values (Choice List specific to incident):
1 = New
2 = In Progress
3 = On Hold
6 = Resolved
7 = Closed
8 = CancelledNote: the state field is inherited from task, but the Choice List values are defined per-table. incident.state = 6 means Resolved. change_request.state = 6 means something completely different.
Service Catalogue — Three-Table Cascade
When a user submits a catalogue request, ServiceNow creates three linked records:
sc_request (REQ) ← The shopping cart / overall request
└── sc_req_item (RITM) ← Each item ordered (extends task)
└── sc_task (SCTASK) ← Fulfilment tasks created by workflow| Table | Prefix | Who manages it |
|---|---|---|
sc_request | REQ | Financial approval, overall status |
sc_req_item | RITM | The actual delivery unit — has its own SLA |
sc_task | SCTASK | Individual to-do items for fulfilment teams |
Why this matters: SLAs on catalogue requests attach to the RITM, not the REQ. Reporting on catalogue fulfilment should query sc_req_item, not sc_request.
change_request — Extends task
Change adds fields for risk, scheduling, and governance:
| Field | Purpose |
|---|---|
type | Normal / Standard / Emergency |
risk | High / Medium / Low |
impact | Business impact of the change |
start_date | Planned implementation start |
end_date | Planned implementation end |
cab_date | CAB review meeting |
cab_recommendation | CAB decision |
implementation_plan | Step-by-step plan |
backout_plan | Rollback procedure |
test_plan | Post-implementation testing |
Data Dictionary (sys_dictionary)
Every field on every table is defined in the Data Dictionary. This is where you control field types, lengths, defaults, and mandatory flags — not in the table record itself.
Key Dictionary Properties
| Property | Controls |
|---|---|
| Type | string, integer, boolean, reference, datetime, html, journal |
| Max length | Character limit for string fields |
| Default value | Pre-filled value on new records |
| Mandatory | Whether the field must be filled before save |
| Read-only | Prevents editing |
| Display value | What shows in the UI vs stored value |
Adding a custom field via Data Dictionary:
- Navigate to the table (e.g., open an Incident form)
- Right-click the form header → Configure → Form Layout
- Or: navigate to
sys_dictionary.list→ New - Set: Table =
incident, Column name =u_business_impact, Type =String, Max length =200 - Custom fields always use
u_prefix (not scoped) orx_scope_(scoped app)
Example — Dictionary query:
// Find all custom fields on the incident table
var dict = new GlideRecord('sys_dictionary');
dict.addQuery('name', 'incident');
dict.addQuery('element', 'STARTSWITH', 'u_'); // Custom fields
dict.query();
while (dict.next()) {
gs.info(dict.element + ' — Type: ' + dict.internal_type);
}CMDB — Configuration Item Database
The CMDB is ServiceNow's inventory of everything the IT organisation is responsible for. Every server, application, network device, database, and service is a Configuration Item (CI).
CMDB Table Hierarchy
cmdb_ci (parent — all CIs)
├── cmdb_ci_server ← Physical and virtual servers
│ ├── cmdb_ci_linux_server
│ └── cmdb_ci_win_server
├── cmdb_ci_appl ← Software applications
├── cmdb_ci_database ← Database instances
├── cmdb_ci_network_adapter← Network devices
├── cmdb_ci_service ← Business/IT services
└── cmdb_ci_endpoint ← Workstations, laptopsKey CMDB Fields
| Field | Purpose |
|---|---|
name | CI name (e.g., "WEB-PROD-01") |
sys_class_name | CI type (e.g., cmdb_ci_linux_server) |
operational_status | In Service / Maintenance / Retired |
environment | Production / Development / Test |
owned_by | CI owner (sys_user) |
managed_by_group | Responsible team (sys_user_group) |
ip_address | For servers and network devices |
Relationships
CIs are linked via the cmdb_rel_ci table:
cmdb_rel_ci
├── parent → CI A
├── child → CI B
└── type → "Runs on::Runs" / "Hosted on::Hosts" / "Depends on::Used by"Example: Linking an incident to a CMDB CI:
// Business Rule: link incident to CI based on category
(function executeRule(current, previous) {
if (current.category == 'network') {
var ci = new GlideRecord('cmdb_ci_network_adapter');
ci.addQuery('name', current.short_description);
ci.setLimit(1);
ci.query();
if (ci.next()) {
current.cmdb_ci = ci.sys_id;
}
}
})(current, previous);Platform Data Model — Summary
ServiceNow Data Model — Building Blocks
Click any step to expand · 5 steps
Common Data Model Mistakes
| Mistake | Impact | Fix |
|---|---|---|
Querying incident when you need cross-process data | Miss change/problem records | Query task table |
Creating custom table instead of extending task | No SLA, no unified queue, no assignment | Extend task |
| Manual CMDB population | Inaccurate, stale data | Use Discovery or import automation |
u_ prefix fields in scoped apps | Naming collision risk | Use x_scope_ prefix |
| Ignoring Choice List isolation per table | Wrong state label displayed | Check Choice List per table, not just task |
Part of the Digital Kimya (opens in a new tab) ServiceNow Guide Series — Identity & Access · Scripts & Logic · Deployment