Reference

Table [Dynamic Table]


Description

No description available

Supported Operations

Below section contains supported CRUD operations. Each operation is executed by some EndPoint behind the scene.
Method Supported Reference EndPoint
SELECT get_table_rows
INSERT insert_table_row
UPDATE update_table_row
UPSERT
DELETE delete_table_row
LOOKUP get_table_rows

Examples

SSIS

Use ServiceNow Connector in API Source component to read data or in API Destination component to read/write data:

Read from [Dynamic Table] table using API Source

API Source - ServiceNow
Read and write ServiceNow data effortlessly. Integrate, manage, and automate incidents, tasks, attachments, and records — almost no coding required.
ServiceNow
[Dynamic Table]
There are no parameters to configure.
SSIS API Source - Read from table or endpoint

Read/write to [Dynamic Table] table using API Destination

API Destination - ServiceNow
Read and write ServiceNow data effortlessly. Integrate, manage, and automate incidents, tasks, attachments, and records — almost no coding required.
ServiceNow
[Dynamic Table]
Select
There are no parameters to configure.
SSIS API Destination - Access table operation

ODBC application

Use these SQL queries in your ODBC application data source:

Read an incident by ID

<p>Gets a single incident by its <code>sys_id</code> (primary key).</p>

SELECT * FROM incident
WHERE sys_id = 'SYS_ID_GOES_HERE'

Read selected columns (performance optimization)

<p>By default, all column values are returned in the result set. You can instruct the ServiceNow API to send only specific columns by setting the <code>Fields</code> parameter in the <code>WITH</code> clause. This significantly speeds up the response.</p>

SELECT number,name FROM incident WITH (Fields='number,name') --Setting Fields parameter will speed up the query

Read table using server-side filter

<h3>Server-side filtering using ServiceNow native query language</h3> <p> This example demonstrates how to filter ServiceNow table data using the native <strong>server-side filter expression</strong> (sysparm_query) via the <code>WITH(Query='...')</code> clause. </p> <p> <strong>Why this matters:</strong><br/> Server-side filtering is executed <em>inside ServiceNow</em> before data is returned. This dramatically improves performance, reduces network traffic, and avoids unnecessary client-side processing. </p> <p> Using a SQL <code>WHERE</code> clause without <code>WITH(Query=...)</code> forces the driver to retrieve more data first and then filter locally, which is slower. Always prefer <strong>server-side filters first</strong>. Use client-side filtering only when a condition cannot be expressed using ServiceNow query syntax. </p> <hr/> <h4>ServiceNow query operators (mapped to SQL)</h4> <table border="1" cellpadding="5" cellspacing="0"> <tr><th>Operator</th><th>Meaning</th><th>SQL Equivalent</th></tr> <tr><td><code>=</code></td><td>Equals</td><td>=</td></tr> <tr><td><code>!=</code></td><td>Not equals</td><td>&lt;&gt;</td></tr> <tr><td><code>IN</code></td><td>In list</td><td>IN (...)</td></tr> <tr><td><code>LIKE</code></td><td>Contains</td><td>LIKE '%x%'</td></tr> <tr><td><code>STARTSWITH</code></td><td>Starts with</td><td>LIKE 'x%'</td></tr> <tr><td><code>ENDSWITH</code></td><td>Ends with</td><td>LIKE '%x'</td></tr> <tr><td><code>^</code></td><td>AND</td><td>AND</td></tr> <tr><td><code>^OR</code></td><td>OR (same group)</td><td>OR</td></tr> <tr><td><code>NQ</code></td><td>New Query (OR group)</td><td>OR (grouped)</td></tr> </table> <p> <strong>Important:</strong><br/> <ul> <li><code>^</code> always means <strong>AND</strong></li> <li><code>^OR</code> applies OR within the same query group</li> <li><code>NQ</code> starts a <strong>new OR group</strong> (similar to adding parentheses in SQL)</li> </ul> </p> <p> Example: <pre> priority=1^state=2^NQpriority=2^state=3 </pre> Is equivalent to SQL: <pre> (priority = 1 AND state = 2) OR (priority = 2 AND state = 3) </pre> </p> <hr/> <h4>Date and time filtering using ZappySys Placeholder Engine</h4> <p> You can dynamically generate date values using placeholders. These are evaluated at runtime before the query is sent to ServiceNow. </p> <ul> <li><code>&lt;&lt;today,FUN_TO_DATE&gt;&gt;</code> – today</li> <li><code>&lt;&lt;yesterday,FUN_TO_DATE&gt;&gt;</code> – yesterday</li> <li><code>&lt;&lt;today-1d,FUN_TO_DATE&gt;&gt;</code> – today minus 1 day</li> <li><code>&lt;&lt;today-1m,FUN_TO_DATE&gt;&gt;</code> – today minus 1 month</li> <li><code>&lt;&lt;monthstart,FUN_TO_DATE&gt;&gt;</code> – current month start</li> <li><code>&lt;&lt;monthend,FUN_TO_DATE&gt;&gt;</code> – current month end</li> <li><code>&lt;&lt;yearstart,FUN_TO_DATE&gt;&gt;</code> – year start</li> <li><code>&lt;&lt;yearend,FUN_TO_DATE&gt;&gt;</code> – year end</li> </ul> <p> See full placeholder documentation here:<br/> <a href="https://zappysys.com/onlinehelp/odbc-powerpack/scr/odbc-format-static-placeholders.htm#fun_FUN_TO_DATETIME" target="_blank"> ZappySys Placeholder Engine – FUN_TO_DATETIME </a> </p> <hr/> <h4>Reference documentation</h4> <ul> <li><a href="https://www.servicenow.com/docs/r/api-reference/rest-apis/c_TableAPI.html" target="_blank">ServiceNow Table API</a></li> <li><a href="https://docs.servicenow.com/bundle/utah-platform-user-interface/page/use/common-ui-elements/reference/r_OpAvailableFiltersQueries.html" target="_blank">ServiceNow Filter Operators</a></li> <li><a href="https://developer.servicenow.com/dev.do#!/learn/learning-plans/xanadu/servicenow_application_developer/app_store_learnv2_rest_xanadu_request_parameters" target="_blank">Advanced Query Parameters</a></li> </ul>

-- Basic server-side filter
SELECT * FROM incident WITH(Query='state=2')

-- Primary key lookup (fastest)
SELECT * FROM incident WHERE sys_id='109562a3c611227500a7b7ff98cc0dc7'

-- Not equal
SELECT * FROM incident WITH(Query='state!=6')

-- IN condition
SELECT * FROM incident WITH(Query='priorityIN1,2,3')

-- AND condition
SELECT * FROM incident WITH(Query='priority=1^state=2')
-- SQL: WHERE priority = 1 AND state = 2

-- OR condition (same group)
SELECT * FROM incident WITH(Query='priority=1^ORstate=2')
-- SQL: WHERE priority = 1 OR state = 2

-- AND / OR mixed using NQ
SELECT * FROM incident WITH(Query='priority=1^state=2^NQpriority=2^state=3')
-- SQL: (priority = 1 AND state = 2) OR (priority = 2 AND state = 3)

-- LIKE / StartsWith / EndsWith
SELECT * FROM incident WITH(Query='short_descriptionLIKEemail')
SELECT * FROM incident WITH(Query='numberSTARTSWITHINC')
SELECT * FROM incident WITH(Query='numberENDSWITH001')

-- Date filter using placeholders (last 1 month)
SELECT * FROM incident WITH(Query='opened_at>=<<today-1m,FUN_TO_DATE>>')

-- From month start
SELECT * FROM incident WITH(Query='opened_at>=<<monthstart,FUN_TO_DATE>>')

-- Between dates
SELECT * FROM incident WITH(Query='opened_at>=<<monthstart,FUN_TO_DATE>>^opened_at<=<<monthend,FUN_TO_DATE>>')

Create an incident

<p>Creates a new incident record.</p>

INSERT INTO incident(incident_state, severity, category, cause)
VALUES (3, 1, 'software', 'Missing a software feature.')

Create an incident using display values

<p>This example demonstrates how to create a new <code>incident</code> record by supplying <strong>human-readable labels (display values)</strong> for reference fields instead of their underlying <code>sys_id</code> values.</p> <p>Normally, ServiceNow requires reference fields (such as <code>caller_id</code> or <code>assignment_group</code>) to be populated using the target record's <code>sys_id</code>. In this example, label-to-ID resolution is explicitly enabled using <code>AllowDisplayValueAsInput='true'</code>, allowing display values to be passed instead.</p> <p>This approach is useful for ad-hoc operations, demos, or interactive usage. For automated or high-volume integrations, using <code>sys_id</code> values is strongly recommended.</p>

-- 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')

Update an incident

<p>Updates an existing incident record.</p>

UPDATE incident
SET cause = 'A bug in the software'
   ,severity = 3
   ,incident_state = 2
WHERE sys_id = 'SYS_ID_GOES_HERE'

Delete an incident

<p>Deletes an incident record.</p>

DELETE FROM incident
WHERE sys_id = 'SYS_ID_GOES_HERE'

SQL Server

Use these SQL queries in SQL Server after you create a data source in Data Gateway:

Read an incident by ID

<p>Gets a single incident by its <code>sys_id</code> (primary key).</p>

DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM incident
WHERE sys_id = ''SYS_ID_GOES_HERE''';

EXEC (@MyQuery) AT [LS_TO_SERVICENOW_IN_GATEWAY];

Read selected columns (performance optimization)

<p>By default, all column values are returned in the result set. You can instruct the ServiceNow API to send only specific columns by setting the <code>Fields</code> parameter in the <code>WITH</code> clause. This significantly speeds up the response.</p>

DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT number,name FROM incident WITH (Fields=''number,name'') --Setting Fields parameter will speed up the query';

EXEC (@MyQuery) AT [LS_TO_SERVICENOW_IN_GATEWAY];

Read table using server-side filter

<h3>Server-side filtering using ServiceNow native query language</h3> <p> This example demonstrates how to filter ServiceNow table data using the native <strong>server-side filter expression</strong> (sysparm_query) via the <code>WITH(Query='...')</code> clause. </p> <p> <strong>Why this matters:</strong><br/> Server-side filtering is executed <em>inside ServiceNow</em> before data is returned. This dramatically improves performance, reduces network traffic, and avoids unnecessary client-side processing. </p> <p> Using a SQL <code>WHERE</code> clause without <code>WITH(Query=...)</code> forces the driver to retrieve more data first and then filter locally, which is slower. Always prefer <strong>server-side filters first</strong>. Use client-side filtering only when a condition cannot be expressed using ServiceNow query syntax. </p> <hr/> <h4>ServiceNow query operators (mapped to SQL)</h4> <table border="1" cellpadding="5" cellspacing="0"> <tr><th>Operator</th><th>Meaning</th><th>SQL Equivalent</th></tr> <tr><td><code>=</code></td><td>Equals</td><td>=</td></tr> <tr><td><code>!=</code></td><td>Not equals</td><td>&lt;&gt;</td></tr> <tr><td><code>IN</code></td><td>In list</td><td>IN (...)</td></tr> <tr><td><code>LIKE</code></td><td>Contains</td><td>LIKE '%x%'</td></tr> <tr><td><code>STARTSWITH</code></td><td>Starts with</td><td>LIKE 'x%'</td></tr> <tr><td><code>ENDSWITH</code></td><td>Ends with</td><td>LIKE '%x'</td></tr> <tr><td><code>^</code></td><td>AND</td><td>AND</td></tr> <tr><td><code>^OR</code></td><td>OR (same group)</td><td>OR</td></tr> <tr><td><code>NQ</code></td><td>New Query (OR group)</td><td>OR (grouped)</td></tr> </table> <p> <strong>Important:</strong><br/> <ul> <li><code>^</code> always means <strong>AND</strong></li> <li><code>^OR</code> applies OR within the same query group</li> <li><code>NQ</code> starts a <strong>new OR group</strong> (similar to adding parentheses in SQL)</li> </ul> </p> <p> Example: <pre> priority=1^state=2^NQpriority=2^state=3 </pre> Is equivalent to SQL: <pre> (priority = 1 AND state = 2) OR (priority = 2 AND state = 3) </pre> </p> <hr/> <h4>Date and time filtering using ZappySys Placeholder Engine</h4> <p> You can dynamically generate date values using placeholders. These are evaluated at runtime before the query is sent to ServiceNow. </p> <ul> <li><code>&lt;&lt;today,FUN_TO_DATE&gt;&gt;</code> – today</li> <li><code>&lt;&lt;yesterday,FUN_TO_DATE&gt;&gt;</code> – yesterday</li> <li><code>&lt;&lt;today-1d,FUN_TO_DATE&gt;&gt;</code> – today minus 1 day</li> <li><code>&lt;&lt;today-1m,FUN_TO_DATE&gt;&gt;</code> – today minus 1 month</li> <li><code>&lt;&lt;monthstart,FUN_TO_DATE&gt;&gt;</code> – current month start</li> <li><code>&lt;&lt;monthend,FUN_TO_DATE&gt;&gt;</code> – current month end</li> <li><code>&lt;&lt;yearstart,FUN_TO_DATE&gt;&gt;</code> – year start</li> <li><code>&lt;&lt;yearend,FUN_TO_DATE&gt;&gt;</code> – year end</li> </ul> <p> See full placeholder documentation here:<br/> <a href="https://zappysys.com/onlinehelp/odbc-powerpack/scr/odbc-format-static-placeholders.htm#fun_FUN_TO_DATETIME" target="_blank"> ZappySys Placeholder Engine – FUN_TO_DATETIME </a> </p> <hr/> <h4>Reference documentation</h4> <ul> <li><a href="https://www.servicenow.com/docs/r/api-reference/rest-apis/c_TableAPI.html" target="_blank">ServiceNow Table API</a></li> <li><a href="https://docs.servicenow.com/bundle/utah-platform-user-interface/page/use/common-ui-elements/reference/r_OpAvailableFiltersQueries.html" target="_blank">ServiceNow Filter Operators</a></li> <li><a href="https://developer.servicenow.com/dev.do#!/learn/learning-plans/xanadu/servicenow_application_developer/app_store_learnv2_rest_xanadu_request_parameters" target="_blank">Advanced Query Parameters</a></li> </ul>

DECLARE @MyQuery NVARCHAR(MAX) = '-- Basic server-side filter
SELECT * FROM incident WITH(Query=''state=2'')

-- Primary key lookup (fastest)
SELECT * FROM incident WHERE sys_id=''109562a3c611227500a7b7ff98cc0dc7''

-- Not equal
SELECT * FROM incident WITH(Query=''state!=6'')

-- IN condition
SELECT * FROM incident WITH(Query=''priorityIN1,2,3'')

-- AND condition
SELECT * FROM incident WITH(Query=''priority=1^state=2'')
-- SQL: WHERE priority = 1 AND state = 2

-- OR condition (same group)
SELECT * FROM incident WITH(Query=''priority=1^ORstate=2'')
-- SQL: WHERE priority = 1 OR state = 2

-- AND / OR mixed using NQ
SELECT * FROM incident WITH(Query=''priority=1^state=2^NQpriority=2^state=3'')
-- SQL: (priority = 1 AND state = 2) OR (priority = 2 AND state = 3)

-- LIKE / StartsWith / EndsWith
SELECT * FROM incident WITH(Query=''short_descriptionLIKEemail'')
SELECT * FROM incident WITH(Query=''numberSTARTSWITHINC'')
SELECT * FROM incident WITH(Query=''numberENDSWITH001'')

-- Date filter using placeholders (last 1 month)
SELECT * FROM incident WITH(Query=''opened_at>=<<today-1m,FUN_TO_DATE>>'')

-- From month start
SELECT * FROM incident WITH(Query=''opened_at>=<<monthstart,FUN_TO_DATE>>'')

-- Between dates
SELECT * FROM incident WITH(Query=''opened_at>=<<monthstart,FUN_TO_DATE>>^opened_at<=<<monthend,FUN_TO_DATE>>'')';

EXEC (@MyQuery) AT [LS_TO_SERVICENOW_IN_GATEWAY];

Create an incident

<p>Creates a new incident record.</p>

DECLARE @MyQuery NVARCHAR(MAX) = 'INSERT INTO incident(incident_state, severity, category, cause)
VALUES (3, 1, ''software'', ''Missing a software feature.'')';

EXEC (@MyQuery) AT [LS_TO_SERVICENOW_IN_GATEWAY];

Create an incident using display values

<p>This example demonstrates how to create a new <code>incident</code> record by supplying <strong>human-readable labels (display values)</strong> for reference fields instead of their underlying <code>sys_id</code> values.</p> <p>Normally, ServiceNow requires reference fields (such as <code>caller_id</code> or <code>assignment_group</code>) to be populated using the target record's <code>sys_id</code>. In this example, label-to-ID resolution is explicitly enabled using <code>AllowDisplayValueAsInput='true'</code>, allowing display values to be passed instead.</p> <p>This approach is useful for ad-hoc operations, demos, or interactive usage. For automated or high-volume integrations, using <code>sys_id</code> values is strongly recommended.</p>

DECLARE @MyQuery NVARCHAR(MAX) = '-- 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'')';

EXEC (@MyQuery) AT [LS_TO_SERVICENOW_IN_GATEWAY];

Update an incident

<p>Updates an existing incident record.</p>

DECLARE @MyQuery NVARCHAR(MAX) = 'UPDATE incident
SET cause = ''A bug in the software''
   ,severity = 3
   ,incident_state = 2
WHERE sys_id = ''SYS_ID_GOES_HERE''';

EXEC (@MyQuery) AT [LS_TO_SERVICENOW_IN_GATEWAY];

Delete an incident

<p>Deletes an incident record.</p>

DECLARE @MyQuery NVARCHAR(MAX) = 'DELETE FROM incident
WHERE sys_id = ''SYS_ID_GOES_HERE''';

EXEC (@MyQuery) AT [LS_TO_SERVICENOW_IN_GATEWAY];