ServiceNow

Watch the tutorial

Overview

The ServiceNow connector enables your Leena AI Agents to integrate with your organization's ServiceNow platform, facilitating automated IT service management workflows, table record operations, attachment handling, and service catalog fulfilment.

ServiceNow is a cloud-based platform that automates workflows for IT service management (ITSM) and various business functions, improving operational efficiency. The ServiceNow connector allows Leena AI to create and manage records in any ServiceNow table (incidents, requests, users, and more), work with attachments, and browse and order from the ServiceNow Service Catalog seamlessly.

API Details

Leena AI integrates with ServiceNow via REST APIs, including the Table API, Attachment API, and Service Catalog API.

Documentation link: https://developer.servicenow.com/dev.do#!/reference/api/latest/rest

Setup

The ServiceNow connector supports four authentication methods:

Auth TypeDescription
Basic authAuthenticates using a ServiceNow username and password
OAuth 2.0Authenticates using an OAuth client (Client ID and Client Secret) along with a ServiceNow user's username and password (password grant type)
OAuth 2.0 client credentialsAuthenticates using only the OAuth client's Client ID, Client Secret, and Scope (client credentials grant type)
Refresh tokenAuthenticates using the OAuth client's Client ID, Client Secret, and a long-lived Refresh token

Prerequisites

Before setting up the ServiceNow connector, ensure you have:

  • Administrator access to your ServiceNow instance
  • Your ServiceNow instance Base URL (e.g., https://<instance-name>.service-now.com)
  • Access to System OAuth > Application Registry in ServiceNow (required for OAuth-based authentication methods)
  • A ServiceNow integration user with the roles required for the tables and catalogs you want to access
  • If your instance uses IP Address Access Control, the ability to allowlist Leena AI's IP addresses in ServiceNow
  • Access to your Leena AI workspace with connector management permissions

Get credentials

For Basic auth:

  1. Log in to your ServiceNow instance as an administrator.
  2. Create (or identify) a dedicated integration user with the roles needed for the tables and catalog operations Leena AI will perform.
  3. Note down the username and password of this user.

For OAuth-based authentication (OAuth 2.0, OAuth 2.0 client credentials, Refresh token):

  1. Log in to your ServiceNow instance as an administrator.
  2. Navigate to System OAuth > Application Registry.
  3. Click New and select Create an OAuth API endpoint for external clients.
  4. Fill in the form:
    1. Name: Enter a descriptive name for the application (e.g., "Leena AI Integration")
    2. Client Secret: Leave blank — ServiceNow auto-generates it on save
    3. Optionally adjust the Access Token Lifespan and Refresh Token Lifespan to match your organization's token policies
  5. Click Submit to save the record.
  6. Reopen the record and copy the Client ID and Client Secret (the secret is hidden behind a lock icon).
  7. For the OAuth 2.0 client credentials grant type, ensure the client credentials grant is enabled on your instance and note the OAuth scope to be used (default: useraccount).
  8. For the Refresh token method, generate a refresh token by requesting a token from https://<instance-name>.service-now.com/oauth_token.do using the client credentials and a ServiceNow user's credentials, and note down the returned refresh token.

Add connection

Here is how to add a connection on Leena AI:

  1. Log in to your Leena AI workspace

  2. Navigate to Settings > Integrations

  3. Search for "ServiceNow" and select it from the list to add its new connector

  4. Start configuring the connector

    1. Base URL: Your ServiceNow instance URL, starting with http:// or https:// (e.g., https://<instance-name>.service-now.com)
    2. Auth type: Select one of the supported authentication methods; the remaining fields depend on your selection
  5. Fill in the authentication fields based on the selected auth type

    Basic auth:

    FieldDescription
    UsernameServiceNow integration user's username
    PasswordServiceNow integration user's password

    OAuth 2.0:

    FieldDescription
    Client IDOAuth application client ID from the Application Registry
    Client secretOAuth application client secret from the Application Registry
    UsernameServiceNow user's username (used for the password grant)
    PasswordServiceNow user's password (used for the password grant)

    OAuth 2.0 client credentials:

    FieldDescription
    Client IDOAuth application client ID from the Application Registry
    Client secretOAuth application client secret from the Application Registry
    ScopeOAuth scope for the token request (pre-filled with the default scope)

    Refresh token:

    FieldDescription
    Client IDOAuth application client ID from the Application Registry
    Client secretOAuth application client secret from the Application Registry
    Refresh tokenLong-lived refresh token generated from your ServiceNow instance
  6. Test and save the connection

    1. Leena AI validates the connection by calling the ServiceNow user table API
    2. If the test fails with an HTTP 403 error, your ServiceNow instance's IP Address Access Control is likely blocking the request — allowlist Leena AI's IP addresses in ServiceNow and retry
    3. Once the test succeeds, save the connector

Actions

The following actions are supported for the ServiceNow connector:

Tables: Get all tables

Retrieves the list of all tables available in the ServiceNow instance. This action can be leveraged by the Leena AI Orchestrator/Agent to discover the tables (e.g., incident, sc_request, sys_user) on which subsequent record operations can be performed.

Input Parameters

This action does not require any input parameters.

Response

The action returns the list of tables in the ServiceNow instance, including table names and labels.

Table records: Create table record

Creates a new record in a ServiceNow table. The Agent can leverage the skill (workflow), which has been designed to create records such as incidents or requests, once the user raises a query to do so. Here are some common use cases:

  • Incident Creation: Raise a new incident when an employee reports an issue
  • Request Logging: Create request records from conversational inputs
  • Record Automation: Insert records into any custom table as part of a workflow

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Table nameThe ServiceNow table in which the record will be created
Record fieldsThe field values for the new record; the available fields are determined dynamically by the selected table's form

Optional

NameDescription
Sys parm display valueWhether to return display values, actual values, or both for the record fields
Sys parm exclude reference linkWhether to exclude Table API links for reference fields in the response
Sys parm fieldsComma-separated list of fields to return in the response
Sys parm input display valueWhether the input field values are treated as display values or actual values
Sys parm viewUI view for which to render the data (desktop, mobile, or both); determines the fields returned in the response

Response

Upon successful creation, the action returns the created record's details, including its Sys ID and field values.

Table records: List table records

Retrieves multiple records from a ServiceNow table with support for filtering, pagination, and field selection. Here are some common use cases:

  • My Tickets: List all incidents raised by an employee
  • Open Items: Fetch records matching a status filter
  • Reporting: Retrieve record sets for summaries and follow-ups

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Table nameThe ServiceNow table from which records will be retrieved
Sys parm limitMaximum number of records to return; for requests that exceed this number, use the offset parameter to paginate (pre-filled with a default value)
Sys parm offsetStarting record index from which to begin retrieving records; used for pagination (pre-filled with a default value)

Optional

NameDescription
Sys parm query available?Toggle that switches the filter input between a name-value pairs form and a raw encoded query
Name value pairs queryList of field name and value pairs used to filter the records
Sys parm queryEncoded query string used to filter the records (available when the query toggle is enabled)
Sys parm display valueWhether to return display values, actual values, or both for the record fields
Sys parm exclude reference linkWhether to exclude Table API links for reference fields in the response
Sys parm fieldsComma-separated list of fields to return in the response
Sys parm no countWhether to execute a count query on the table to return the number of rows
Sys parm query categoryName of the category to use for queries
Sys query no domainWhether to restrict the record search to only the domains for which the logged-in user is configured
Sys parm suppress pagination headerWhether to remove the link header (pagination URLs) from the response
Sys parm viewUI view for which to render the data (desktop, mobile, or both); determines the fields returned in the response

Response

The action returns the list of matching records with their field values.

Table records: Get table record

Retrieves a single record from a ServiceNow table by its Sys ID. Here are some common use cases:

  • Ticket Status: Fetch the current state of a specific incident
  • Record Lookup: Retrieve full details of a record referenced in a conversation

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Table nameThe ServiceNow table containing the record
Sys IDThe unique identifier of the record to be retrieved

Optional

NameDescription
Sys parm display valueWhether to return display values, actual values, or both for the record fields
Sys parm exclude reference linkWhether to exclude Table API links for reference fields in the response
Sys parm fieldsComma-separated list of fields to return in the response
Sys query no domainWhether to restrict the record search to only the domains for which the logged-in user is configured
Sys parm viewUI view for which to render the data (desktop, mobile, or both); determines the fields returned in the response

Response

The action returns the requested record's details, including all requested field values.

Table records: Update table record

Updates an existing record in a ServiceNow table. Here are some common use cases:

  • Ticket Updates: Update the state, assignment, or work notes of an incident
  • Data Corrections: Modify field values on any table record as part of a workflow

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Table nameThe ServiceNow table containing the record
Sys IDThe unique identifier of the record to be updated
Record fieldsThe field values to update; the available fields are determined dynamically by the selected table's form

Optional

NameDescription
Sys parm display valueWhether to return display values, actual values, or both for the record fields
Sys parm query no domainWhether to restrict the record search to only the domains for which the logged-in user is configured
Sys parm fieldsComma-separated list of fields to return in the response
Sys parm input display valueWhether the input field values are treated as display values or actual values
Sys parm viewUI view for which to render the data (desktop, mobile, or both); determines the fields returned in the response

Response

Upon successful update, the action returns the updated record's details.

Attachment: Add attachment

Uploads an attachment to an existing record in a ServiceNow table. Here are some common use cases:

  • Evidence Upload: Attach screenshots or documents to an incident
  • Document Handling: Attach files collected during a conversation to a request record

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Table nameThe ServiceNow table containing the record to which the attachment will be added
Table sys IDThe Sys ID of the record to which the attachment will be added
File nameName of the file being attached
File data (URL/Base64)The file content, provided either as a URL or as a Base64-encoded string

Response

Upon successful upload, the action returns the attachment details, including its Sys ID and download link.

Attachment: Get attachment

Retrieves an attachment from ServiceNow by its Sys ID. Here are some common use cases:

  • File Retrieval: Download a file attached to an incident or request
  • Content Sharing: Fetch an attachment to share with an employee in a conversation

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Attachment sys IDThe unique identifier of the attachment to be retrieved

Response

The action returns the attachment metadata and content.

Service catalog: Get catalogs

Retrieves the list of service catalogs available in the ServiceNow instance. Here are some common use cases:

  • Catalog Discovery: List the catalogs an employee can order from
  • Guided Ordering: Present available catalogs as the first step of an ordering workflow

Input Parameters

Here are the input parameters required to set up this action:

Optional

NameDescription
Sys parm limitMaximum number of catalogs to return (pre-filled with a default value)
Sys parm textKeyword to search for in the title field of the available service catalogs
Sys parm viewUI view for which to render the data (desktop, mobile, or both)

Response

The action returns the list of service catalogs with their titles and Sys IDs.

Service catalog: Get catalog detail

Retrieves the details of a specific service catalog. Here are some common use cases:

  • Catalog Overview: Fetch the description and structure of a chosen catalog

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Catalog sys IDThe unique identifier of the service catalog to be retrieved

Optional

NameDescription
Sys parm viewUI view for which to render the data (desktop, mobile, or both)

Response

The action returns the details of the requested service catalog.

Service catalog: Get catalog catagories

Retrieves the categories within a specific service catalog. Here are some common use cases:

  • Category Browsing: List the categories (e.g., Hardware, Software) inside a catalog
  • Guided Ordering: Narrow down an employee's request to the right category

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Catalog sys IDThe unique identifier of the service catalog whose categories will be retrieved

Optional

NameDescription
Sys parm limitMaximum number of categories to return (pre-filled with a default value)
Sys parm offsetStarting index from which to begin retrieving categories; used for pagination (pre-filled with a default value)
Sys parm top level onlyWhether to return only top-level categories
Sys parm viewUI view for which to render the data (desktop, mobile, or both)

Response

The action returns the list of categories in the catalog with their titles and Sys IDs.

Service catalog: Get category detail

Retrieves the details of a specific category within a service catalog.

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Catalog sys IDThe unique identifier of the service catalog containing the category
Category sys IDThe unique identifier of the category to be retrieved

Optional

NameDescription
Sys parm viewUI view for which to render the data (desktop, mobile, or both)

Response

The action returns the details of the requested category.

Service catalog: Get category items

Retrieves the catalog items within a specific category. Here are some common use cases:

  • Item Browsing: List the orderable items (e.g., laptops, software licenses) in a category
  • Search: Find catalog items matching a keyword

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Catalog SysIdThe unique identifier of the service catalog containing the items
Category sys IDThe unique identifier of the category whose items will be retrieved

Optional

NameDescription
Sys parm limitMaximum number of items to return (pre-filled with a default value)
Sys parm offsetStarting index from which to begin retrieving items; used for pagination (pre-filled with a default value)
Sys parm textKeyword to search for in the title field of the catalog items
Sys parm typeType of catalog item to filter by
Sys parm viewUI view for which to render the data (desktop, mobile, or both)

Response

The action returns the list of catalog items in the category with their titles and Sys IDs.

Service catalog: Get item detail

Retrieves the details of a specific catalog item, including the variables (form fields) required to order it. Here are some common use cases:

  • Item Preview: Show an employee the details and required inputs of an item before ordering
  • Dynamic Forms: Fetch item variables to drive a conversational ordering flow

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
ItemThe catalog item whose details will be retrieved

Optional

NameDescription
Catalog SysIdThe service catalog used to filter the item selection
Category SysIdThe category used to filter the item selection
Sys parm viewUI view for which to render the data (desktop, mobile, or both)

Response

The action returns the item details, including its description, pricing information, and variables.

Service catalog: Submit order

Submits an order for a catalog item on behalf of a user, creating a request in ServiceNow. Here are some common use cases:

  • Hardware Requests: Order a laptop or accessory for an employee
  • Software Requests: Order software licenses through the catalog
  • On-behalf Ordering: Submit a request for another employee or a group of employees

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
ItemThe catalog item to be ordered
QuantityThe number of units of the item to order

Optional

NameDescription
Catalog SysIdThe service catalog used to filter the item selection
Category SysIdThe category used to filter the item selection
Variables form?Toggle that switches the variables input between a dynamic form and a code/JSON input
VariablesThe item's variable values; the available variables are determined dynamically by the selected catalog item
Request forThe user for whom the order is being requested
Also request forAdditional users for whom the order is being requested

Response

Upon successful submission, the action returns the created request details, including the request number and Sys ID.

Service catalog: Submit producer

Submits a record producer in the service catalog, which creates a record (such as an incident or case) directly from a catalog form. Here are some common use cases:

  • Report an Issue: Submit an incident through a record producer form
  • HR/IT Case Creation: Create cases from conversational inputs via record producers

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
ItemThe record producer to be submitted

Optional

NameDescription
Catalog SysIdThe service catalog used to filter the record producer selection
Category SysIdThe category used to filter the record producer selection
Variables form?Toggle that switches the variables input between a dynamic form and a code/JSON input
VariablesThe record producer's variable values; the available variables are determined dynamically by the selected record producer
Sys parm viewUI view for which to render the data (desktop, mobile, or both)

Response

Upon successful submission, the action returns the details of the record created by the record producer, including its number and Sys ID.



Did this page help you?