Create an incident using display values
This example demonstrates how to create a new incident record by supplying
human-readable labels (display values) for reference fields instead of
their underlying sys_id values.
Normally, ServiceNow requires reference fields (such as caller_id or
assignment_group) to be populated using the target record's sys_id.
In this example, label-to-ID resolution is explicitly enabled using
AllowDisplayValueAsInput='true', allowing display values to be passed instead.
This approach is useful for ad-hoc operations, demos, or interactive usage.
For automated or high-volume integrations, using sys_id values is strongly recommended.
-- Create a new Incident using DISPLAY VALUES (labels) for reference fields
-- Instead of passing sys_id values, this example uses human-readable labels.
-- This works ONLY because AllowDisplayValueAsInput='true' is specified.
INSERT INTO incident
(
short_description,
incident_state,
severity,
category,
caller_id, -- reference to sys_user
assignment_group -- reference to sys_user_group
)
VALUES
(
'Email service is intermittently failing',
2, -- In Progress
1, -- High severity
'software',
'John Doe', -- LABEL (user display name), not sys_id
'Network' -- LABEL (group name), not sys_id
)
WITH(AllowDisplayValueAsInput='true')