Reference

Endpoint Get Record Labels (Tags)


Name

get_record_labels

Description

Returns UI labels (tags) applied to a specific record using the ServiceNow label framework.

Parameters

Parameter Required Options
Name: ParentTableName

Label: Parent Table Name

Name of the parent table (for example: incident, problem, change_request).
YES
Name: TableName

Label: Table (***DO NOT CHANGE***)

Name: ShowDisplayValue

Label: ShowDisplayValue

Name: ParentSysId

Label: Parent Record Sys_ID

Sys_ID of the parent record for which labels (tags) should be retrieved.
Name: Query

Label: Additional Filter (Optional)

Optional encoded query to further filter label entries (for example by date or creator).
Option Value
Equals (Label Name) label.name=trial
Starts With (Label) label.nameSTARTSWITHodbc
Contains (Label) label.nameLIKEpower
Does Not Contain (Label) label.nameNOT LIKEdeprecated
Created By User sys_created_by=admin
Created After Date sys_created_on>=2026-01-01
Created Before Date sys_created_on<=2026-01-31 23:59:59
Created Today sys_created_on>=<>^sys_created_on<=<>
Created Last 7 Days sys_created_on>=<>
Multiple Label Filters label.nameLIKEodbc^label.nameNOT LIKEdeprecated
Order By Label Name ORDERBYlabel.name
Order By Created Date ORDERBYsys_created_on
Order By Created Date (Descending) ORDERBYDESCsys_created_on
Filter + Order label.nameLIKEtrial^ORDERBYDESCsys_created_on

Output Columns

Label Data Type (SSIS) Data Type (SQL) Length Description
sys_id DT_WSTR nvarchar(32) 32
[$parent.Pivot_Name$] DT_WSTR nvarchar(2000) 2000
[$parent.Pivot_Name$]_diaplay_value DT_WSTR nvarchar(2000) 2000
If the column you are looking for is missing, consider customizing ServiceNow Connector.

Input Columns

Label Data Type (SSIS) Data Type (SQL) Length Description
There are no Static columns defined for this endpoint. This endpoint detects columns dynamically at runtime.

Examples

SSIS

Use ServiceNow Connector in API Source or in API Destination SSIS Data Flow components to read or write data.

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
Get Record Labels (Tags)
Required Parameters
Parent Table Name Fill-in the parameter...
Optional Parameters
Table (***DO NOT CHANGE***) label_entry
ShowDisplayValue true
Parent Record Sys_ID
Additional Filter (Optional)
SSIS API Source - Read from table or endpoint

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
Get Record Labels (Tags)
Required Parameters
Parent Table Name Fill-in the parameter...
Optional Parameters
Table (***DO NOT CHANGE***) label_entry
ShowDisplayValue true
Parent Record Sys_ID
Additional Filter (Optional)
SSIS API Destination - Access table or endpoint

ODBC application

Use these SQL queries in your ODBC application data source:

Query Record Labels (Tags) Using Parent Table and Record

-- 1. Get ALL labels (tags) for a specific Problem record
SELECT *
FROM get_record_labels
WITH(
	ParentTableName='problem',
	ParentSysId='62304320731823002728660c4cf6a7e8'
)

-- 2. Check whether the record has a specific label
SELECT *
FROM get_record_labels
WITH(
	ParentTableName='problem',
	ParentSysId='62304320731823002728660c4cf6a7e8',
	Query='label.name=trial'
)

-- 3. Get labels where the name starts with a prefix (e.g. odbc*)
SELECT *
FROM get_record_labels
WITH(
	ParentTableName='problem',
	ParentSysId='62304320731823002728660c4cf6a7e8',
	Query='label.nameSTARTSWITHodbc'
)

-- 4. Get labels where the name contains a keyword
SELECT *
FROM get_record_labels
WITH(
	ParentTableName='problem',
	ParentSysId='62304320731823002728660c4cf6a7e8',
	Query='label.nameLIKEpower'
)

-- 5. Get labels added by a specific user
SELECT *
FROM get_record_labels
WITH(
	ParentTableName='problem',
	ParentSysId='62304320731823002728660c4cf6a7e8',
	Query='sys_created_by=admin'
)

-- 6. Get labels added in the last 7 days
SELECT *
FROM get_record_labels
WITH(
	ParentTableName='problem',
	ParentSysId='62304320731823002728660c4cf6a7e8',
	Query='sys_created_on>=<<today-7d,FUN_TO_DATETIME>>'
)

-- 7. Combine multiple filters and order by most recent label
SELECT *
FROM get_record_labels
WITH(
	ParentTableName='problem',
	ParentSysId='62304320731823002728660c4cf6a7e8',
	Query='label.nameLIKEtrial^sys_created_by=admin^ORDERBYDESCsys_created_on'
)

SQL Server

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

Query Record Labels (Tags) Using Parent Table and Record

DECLARE @MyQuery NVARCHAR(MAX) = '-- 1. Get ALL labels (tags) for a specific Problem record
SELECT *
FROM get_record_labels
WITH(
	ParentTableName=''problem'',
	ParentSysId=''62304320731823002728660c4cf6a7e8''
)

-- 2. Check whether the record has a specific label
SELECT *
FROM get_record_labels
WITH(
	ParentTableName=''problem'',
	ParentSysId=''62304320731823002728660c4cf6a7e8'',
	Query=''label.name=trial''
)

-- 3. Get labels where the name starts with a prefix (e.g. odbc*)
SELECT *
FROM get_record_labels
WITH(
	ParentTableName=''problem'',
	ParentSysId=''62304320731823002728660c4cf6a7e8'',
	Query=''label.nameSTARTSWITHodbc''
)

-- 4. Get labels where the name contains a keyword
SELECT *
FROM get_record_labels
WITH(
	ParentTableName=''problem'',
	ParentSysId=''62304320731823002728660c4cf6a7e8'',
	Query=''label.nameLIKEpower''
)

-- 5. Get labels added by a specific user
SELECT *
FROM get_record_labels
WITH(
	ParentTableName=''problem'',
	ParentSysId=''62304320731823002728660c4cf6a7e8'',
	Query=''sys_created_by=admin''
)

-- 6. Get labels added in the last 7 days
SELECT *
FROM get_record_labels
WITH(
	ParentTableName=''problem'',
	ParentSysId=''62304320731823002728660c4cf6a7e8'',
	Query=''sys_created_on>=<<today-7d,FUN_TO_DATETIME>>''
)

-- 7. Combine multiple filters and order by most recent label
SELECT *
FROM get_record_labels
WITH(
	ParentTableName=''problem'',
	ParentSysId=''62304320731823002728660c4cf6a7e8'',
	Query=''label.nameLIKEtrial^sys_created_by=admin^ORDERBYDESCsys_created_on''
)';

EXEC (@MyQuery) AT [LS_TO_SERVICENOW_IN_GATEWAY];