ServiceNow

Overview

The ServiceNow connector enables your Leena AI Agents to integrate with your organization's ServiceNow platform, facilitating automated IT Service Management (ITSM), record management, service catalog ordering, and attachment handling workflows.

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 automate ITSM workflows, manage records across any table, order service catalog items, and handle file attachments seamlessly.

API Details

Leena AI integrates with ServiceNow via REST APIs.

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

Setup

The ServiceNow connector supports multiple authentication methods: Basic Authentication, OAuth 2.0, and Refresh Token authentication.


Prerequisites

Before setting up the ServiceNow connector, ensure you have:

  • Administrator access to your ServiceNow instance
  • Access to System OAuth > Application Registry in ServiceNow
  • Ability to create OAuth applications or user credentials in ServiceNow
  • Access to your Leena AI workspace with connector management permissions
  • Required ServiceNow plugins activated (OAuth 2.0, REST API Provider)

Get credentials

Option 1: Basic Authentication

Here is how to set up Basic Authentication credentials:

  1. Log in to your ServiceNow instance as an administrator
  2. Create or identify a user account for API access:
    1. Navigate to User Administration > Users
    2. Create a new user or select an existing user
    3. Ensure the user has appropriate roles (e.g., itil, admin, or custom roles based on required access)
  3. Reset the service account password:
    1. Important: Log in to ServiceNow once using the service account credentials
    2. You will be prompted to reset/change the password on first login
    3. Set a new password for the service account
    4. This step is required before the credentials can be used for API authentication
  4. Note the credentials:
    1. Username: The ServiceNow user's username
    2. Password: The newly set ServiceNow user's password

Option 2: OAuth 2.0 Authentication

Here is how to create an OAuth client in ServiceNow:

  1. Log in to your ServiceNow instance (Ensure you're signed in as an admin)
  2. Activate Required Plugins:
    1. Navigate to System Definition > Plugins
    2. Ensure the following plugins are active:
      • OAuth 2.0 (com.snc.platform.security.oauth)
      • REST API Provider (com.glide.rest)
  3. Create OAuth Application Registry:
    1. Navigate to System OAuth > Application Registry
    2. Click New
    3. Select "Create an OAuth API endpoint for external clients"
  4. Configure OAuth Client Details:
    1. Name: Enter a descriptive name (e.g., "Leena AI Integration")
    2. Client ID: Auto-generated or specify a custom ID
    3. Client Secret: Auto-generated (note this value)
    4. Redirect URL: Leave blank or add if required
    5. Active: Checked
  5. Save and Note Credentials:
    1. Note the Client ID and Client Secret
    2. These credentials will be used along with username and password for OAuth 2.0 authentication

Option 3: Refresh Token Authentication

For Refresh Token authentication, follow the OAuth 2.0 setup above. You will need:

  • Client ID
  • Client Secret
  • Refresh Token (obtained from initial OAuth flow)

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 (e.g., https://your-instance.service-now.com)
    2. Auth Type: Select your preferred authentication method:
      • Basic Auth: Username and Password
      • OAuth 2.0: Client ID, Client Secret, Username, and Password
      • Refresh Token: Client ID, Client Secret, and Refresh Token
  5. Enter authentication credentials based on selected auth type:

    For Basic Auth:

    1. Username: ServiceNow username
    2. Password: ServiceNow password

    For OAuth 2.0:

    1. Client ID: OAuth application client ID
    2. Client Secret: OAuth application client secret
    3. Username: ServiceNow username
    4. Password: ServiceNow password

    For Refresh Token:

    1. Client ID: OAuth application client ID
    2. Client Secret: OAuth application client secret
    3. Refresh Token: Pre-obtained refresh token
  6. Save the connection configuration

Actions

The following actions are supported for the ServiceNow connector:

Table Records: Create Table Record

Creates a new record in any ServiceNow table. The Agent can leverage the skill (workflow), which has been designed to create a new record in ServiceNow, once the user raises a query to do so. The system dynamically generates a form based on the selected table's schema.


Input Parameters

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

Mandatory

NameDescription
Table NameThe name of the ServiceNow table to create a record in

Optional

Name

Description

Sys Parm Display Value

Return field display values, options:

  • true: Returns the display values for all fields
  • false: Returns the actual values from the database
  • all: Returns both actual and display values

Sys Parm Exclude Reference Link

Whether to exclude Table API links for reference fields, options:

  • true: Exclude Table API links for reference fields
  • false: Include Table API links for reference fields

Sys Parm Fields

Comma-separated list of fields to return in the response

Sys Parm Input Display Value

How to treat input values, options:

  • true: Treats input values as display values and stores them properly
  • false: Treats input values as actual values and stores them without manipulation

Sys Parm View

UI view for which to render the data, options:

  • desktop: Desktop view
  • mobile: Mobile view
  • both: Both views

Dynamic Fields

Additional table-specific fields are dynamically generated based on the selected table's schema

Here is a sample JSON input:

{
  "tableName": "incident",
  "short_description": "Network connectivity issue in Building A",
  "description": "Users in Building A are experiencing intermittent network connectivity issues since 9 AM.",
  "urgency": "2",
  "impact": "2",
  "category": "Network",
  "subcategory": "Connectivity",
  "assignment_group": "Network Support",
  "sysparm_display_value": "true"
}

Response

Upon successful creation, the action returns the created record details including:

  • Record sys_id
  • Record number
  • All field values (based on sysparm_fields or default fields)
  • Reference links (if not excluded)

Table Records: List Table Records

Retrieves a list of records from any ServiceNow table. This action can be leveraged by Leena AI Orchestrator/Agent to list down all the records in a specific table or records matching specific criteria. Here are some common use cases:

  • Incident Management: Get all open incidents assigned to a team
  • Asset Tracking: List all hardware assets in a specific location
  • User Lookup: Find users matching specific criteria
  • Change Requests: Retrieve pending change requests for approval

Input Parameters

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

Mandatory

NameDescription
Table NameThe name of the ServiceNow table to retrieve records from

Optional

Name

Description

Name Value Pairs Query

Name-value pairs to filter the result set. Mutually exclusive with Sys Parm Query

Sys Parm Query

Encoded query used to filter the result set (e.g., active=true^priority=1)

Sys Parm Display Value

Return field display values, options:

  • true: Returns the display values for all fields
  • false: Returns the actual values from the database
  • all: Returns both actual and display values

Sys Parm Exclude Reference Link

Whether to exclude Table API links for reference fields

Sys Parm Fields

Comma-separated list of fields to return in the response

Sys Parm Limit

Maximum number of records to return (default: 10000)

Sys Parm Offset

Starting record index for pagination (default: 0)

Sys Parm No Count

Flag to skip executing count query on the table

Sys Parm Query Category

Name of the category to use for queries

Sys Query No Domain

Flag to restrict the record search to configured domains

Sys Parm Suppress Pagination Header

Flag to remove the Link header from the response

Sys Parm View

UI view for which to render the data (desktop/mobile/both)

Here is a sample JSON input:

// Using Name Value Pairs
{
  "tableName": "incident",
  "nameValuePairs": [
    {"name": "active", "value": "true"},
    {"name": "priority", "value": "1"}
  ],
  "sysparm_limit": "50",
  "sysparm_offset": "0",
  "sysparm_display_value": "true",
  "sysparm_fields": "number,short_description,priority,state,assigned_to"
}

// Using Encoded Query
{
  "tableName": "incident",
  "sysparm_query": "active=true^priority=1^ORpriority=2^state!=6",
  "sysparm_limit": "100",
  "sysparm_display_value": "all"
}

Response

The action returns a list of records, each containing:

  • Record sys_id
  • Record number
  • Requested field values
  • Total count (in X-Total-Count header if not suppressed)
  • Pagination links (if not suppressed)

Table Records: Get Table Record

Retrieves a specific record from any ServiceNow table by its unique System ID (sys_id). The Agent can leverage this action to fetch detailed information about a specific record.


Input Parameters

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

Mandatory

NameDescription
Table NameThe name of the ServiceNow table containing the record
Sys IdThe unique system identifier (sys_id) of the record

Optional

Name

Description

Sys Parm Display Value

Return field display values, options:

  • true: Returns the display values for all fields
  • false: Returns the actual values from the database
  • all: Returns both actual and display values

Sys Parm Exclude Reference Link

Whether to exclude Table API links for reference fields

Sys Parm Fields

Comma-separated list of fields to return in the response

Sys Query No Domain

Flag to restrict the record search to configured domains

Sys Parm View

UI view for which to render the data (desktop/mobile/both)

Here is a sample JSON input:

{
  "tableName": "incident",
  "sysId": "a9e30c7dc61122760116894de7bcc7bd",
  "sysparm_display_value": "all",
  "sysparm_fields": "number,short_description,description,priority,state,assigned_to,opened_at,resolved_at"
}

Response

The action returns the record details including:

  • Record sys_id
  • All requested field values
  • Display values and actual values (based on sysparm_display_value)
  • Reference links (if not excluded)

Table Records: Update Table Record

Updates an existing record in any ServiceNow table. The Agent can leverage the skill (workflow), which has been designed to modify an existing record in ServiceNow, once the user provides the record details to be updated. Here are some common use cases:

  • Update Incident Status: Change incident state to resolved or closed
  • Reassign Tasks: Update assignment group or assigned user
  • Add Work Notes: Update work notes or comments on a record
  • Modify Priority: Change urgency, impact, or priority of records
  • Update Custom Fields: Modify any field values on the record

Input Parameters

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

Mandatory

NameDescription
Table NameThe name of the ServiceNow table containing the record
Sys IdThe unique system identifier (sys_id) of the record

Optional

NameDescription
Sys Parm Display ValueReturn field display values (true/false/all)
Sys Parm Query No DomainFlag to restrict the record search to configured domains
Sys Parm FieldsComma-separated list of fields to return in the response
Sys Parm Input Display ValueHow to treat input values (true/false)
Sys Parm ViewUI view for which to render the data (desktop/mobile/both)
Dynamic FieldsAdditional table-specific fields are dynamically generated based on the selected table's schema

Here is a sample JSON input:

// Update Incident Status
{
  "tableName": "incident",
  "sysId": "a9e30c7dc61122760116894de7bcc7bd",
  "state": "6",
  "close_code": "Solved (Permanently)",
  "close_notes": "Issue resolved by replacing faulty network switch.",
  "sysparm_display_value": "true"
}

// Reassign Incident
{
  "tableName": "incident",
  "sysId": "a9e30c7dc61122760116894de7bcc7bd",
  "assignment_group": "Database Support",
  "assigned_to": "john.doe",
  "work_notes": "Escalating to Database team for further investigation."
}

// Update Priority
{
  "tableName": "incident",
  "sysId": "a9e30c7dc61122760116894de7bcc7bd",
  "urgency": "1",
  "impact": "1",
  "priority": "1"
}

Response

Upon successful update, the action returns the updated record details including:

  • Updated field values
  • Record sys_id
  • Modification timestamp
  • All requested fields in response

Attachment: Add Attachment

Uploads a file attachment to a record in any ServiceNow table. The Agent can leverage the skill (workflow), which has been designed to attach files to ServiceNow records. Here are some common use cases:

  • Attach Logs: Upload error logs or system logs to incidents
  • Supporting Documents: Attach screenshots or documentation to tickets
  • Evidence Files: Upload evidence files to change requests
  • Reports: Attach generated reports to records

Input Parameters

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

Mandatory

NameDescription
Table NameThe name of the ServiceNow table to attach the file to
Table Sys IdThe sys_id of the record to attach the file to
File NameThe name to give the attachment in ServiceNow
File DataThe file content as either a public URL or Base64 encoded string

Here is a sample JSON input:

// Attach file from URL
{
  "tableName": "incident",
  "tableSysId": "a9e30c7dc61122760116894de7bcc7bd",
  "fileName": "error_log.txt",
  "fileData": "https://example.com/files/error_log.txt"
}

// Attach file from Base64
{
  "tableName": "incident",
  "tableSysId": "a9e30c7dc61122760116894de7bcc7bd",
  "fileName": "screenshot.png",
  "fileData": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
}

Response

Upon successful upload, the action returns:

  • Attachment sys_id
  • Attachment metadata
  • File size
  • Content type
  • Download link

Attachment: Get Attachment

Retrieves an existing file attachment from a ServiceNow record. The Agent can leverage this action to download attachments for further processing or to provide to users.


Input Parameters

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

Mandatory

NameDescription
Attachment Sys IdThe unique sys_id of the attachment record

Here is a sample JSON input:

{
  "sysId": "b7e30c7dc61122760116894de7bcc7bd"
}

Response

The action returns the attachment including:

  • Attachment metadata (filename, content type, size)
  • Attachment content as Base64 encoded string

Service Catalog: Submit Order

Submits an order for a service catalog item in ServiceNow. The Agent can leverage the skill (workflow), which has been designed to order items from the ServiceNow service catalog with dynamic forms for item-specific variables. Here are some common use cases:

  • Hardware Requests: Order laptops, monitors, or other equipment
  • Software Access: Request access to software applications
  • Service Requests: Submit requests for IT services
  • Team Orders: Place orders on behalf of team members

Input Parameters

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

Mandatory

NameDescription
Catalog SysIdThe sys_id of the service catalog
Category SysIdThe sys_id of the category within the catalog
ItemThe sys_id of the catalog item to order
QuantityThe number of items to order

Optional

NameDescription
VariablesItem-specific variables/options. Dynamic fields are generated based on the selected item's configuration in ServiceNow
Request ForThe sys_id of the user to request the item for (if ordering on behalf of someone)
Also Request ForAdditional users to include in the request (comma-separated sys_ids)

Here is a sample JSON input:

// Basic Order
{
  "sysparm_catalog": "e0d08b13c3330100c8b837659bba8fb4",
  "sysparm_category": "2809952237b1300054b6a3549dbe5dd4",
  "itemId": "0d08b13c3330100c8b837659bba8fb47",
  "sysParmQuantity": 1
}

// Order with Variables
{
  "sysparm_catalog": "e0d08b13c3330100c8b837659bba8fb4",
  "sysparm_category": "2809952237b1300054b6a3549dbe5dd4",
  "itemId": "0d08b13c3330100c8b837659bba8fb47",
  "sysParmQuantity": 1,
  "variables": {
    "memory_upgrade": "16GB",
    "storage_size": "512GB SSD",
    "operating_system": "Windows 11 Pro"
  },
  "sysParmRequestedFor": "681ccaf9c0a8016400b98a06818d57c7"
}

// Order for Multiple Users
{
  "sysparm_catalog": "e0d08b13c3330100c8b837659bba8fb4",
  "sysparm_category": "2809952237b1300054b6a3549dbe5dd4",
  "itemId": "0d08b13c3330100c8b837659bba8fb47",
  "sysParmQuantity": 5,
  "sysParmRequestedFor": "681ccaf9c0a8016400b98a06818d57c7",
  "sysParmAlsoRequestFor": ["781ccaf9c0a8016400b98a06818d57c8", "881ccaf9c0a8016400b98a06818d57c9"]
}

Response

Upon successful order submission, the action returns:

  • Request number
  • Request sys_id
  • Request item details
  • Requested for user information
  • Order status

Service Catalog: Submit Producer

Submits a record producer request in ServiceNow. Record producers are catalog items that create records (like incidents or change requests) instead of generating orders. Here are some common use cases:

  • Report Issues: Submit incident reports through catalog interface
  • Change Requests: Submit change requests with guided forms
  • Service Tickets: Create service tickets with predefined templates

Input Parameters

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

Mandatory

NameDescription
Catalog SysIdThe sys_id of the service catalog
Category SysIdThe sys_id of the category within the catalog
ItemThe sys_id of the record producer item

Optional

NameDescription
VariablesItem-specific variables dynamically generated based on the item

Here is a sample JSON input:

{
  "sysparm_catalog": "e0d08b13c3330100c8b837659bba8fb4",
  "sysparm_category": "2809952237b1300054b6a3549dbe5dd4",
  "itemId": "1d08b13c3330100c8b837659bba8fb48",
  "variables": {
    "short_description": "VPN connection failing intermittently",
    "description": "Unable to maintain stable VPN connection since yesterday morning.",
    "category": "Network",
    "subcategory": "VPN"
  }
}

Response

Upon successful submission, the action returns:

  • Created record number
  • Record sys_id
  • Record details
  • Table name where record was created