Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This component is a simple notifier adapter which can be used together with the Iguana X notification system to create incident tickets in ServiceNow using the ServiceNow Table API.

This component can be adapted according to your requirementsNeed help? Contact us:

...

 

The ServiceNow adapter is designed to provide a template for getting started with ServiceNow API integrations. It leverages the SERVICENOW Library to:

  1. Authenticate with the ServiceNow API via OAuth2.0 (JWT).

  2. Create and retrieve Incident table records in ServiceNow.

This component can be customized and adapted according to your workflow needs. For example, it could be adapted as a Notifications component that integrates Iguana notifications with an existing support workflow. The ServiceNow Rest API Explorer is useful for reviewing the available API endpoints.

Component Setup:

Expand
titleLogin or sign up for a ServiceNow Developer Account and create an Iguana App

Refer to Set up a ServiceNow Developer Sandbox for the ServiceNow sign up and application set up required in order to gather the authentication details needed for the ServiceNow NotifierAdapter.

Expand
titleImport the ServiceNow Notifier component

See Create a Component if this is your first time!

Expand
titleConfigure your domain and authentication details in the ServiceNow Notifier Custom Fields
Expand
titleSERVICENOWcreateTbRecord - prepares arguments for SERVICENOWcustom to create an incident ticket
  • Domain: the ServiceNow Instance ID from your developer account, ex. domain.service-now.com.

  • PrivateKey: certificate file private key previously generated to be used for signing the JWT.

  • ClientID and ClientSecret supplied by the ServiceNow application endpoint.

  • KeyIdKid: the kid (key id) from the JWT Verifier Maps ServiceNow table.

  • UserField: must match what was configured in the JWT (ex. if UserField = Email, this is the user's email address).

Using the information provided, the ServiceNow component will run through the authentication workflow and set the Key and KeyExpiry value of the obtained access token automatically. These values do not need to be configured manually.

Screen Shot 2024-04-04 at 2.27.58 PM.pngImage Removed
Expand
titleIn the Translator, update the caller ID to the sys_id of your ServiceNow user

In the Translator, update the caller ID in the createTbRecord function so any newly created tickets will be associated with the appropriate user.

Screen Shot 2024-04-04 at 2.36.30 PM.pngImage Removed

In ServiceNow, this caller ID will be the sys_id of the user you wish to associate with the tickets. This can be retrieved by going to Organizations > Users, searching for your user, and right-clicking the User ID to choose the option to copy the sys_id (will be a long character string).

Screen Shot 2024-04-04 at 2.41.54 PM.pngImage Removed
Expand
titleIn Settings > Notifications, select to use the ServiceNow component

In Settings > Notifications, click EDIT and select the ServiceNow Notifier to be invoked by notification rules. Click Save.

Screen Shot 2024-04-04 at 2.30.34 PM.pngImage Removed
Expand
titleStart the component, trigger an Iguana notification and go to ServiceNow to view the ticket
  1. Start the ServiceNow Notifier component and trigger a notification rule using any of your other components.

  2. In ServiceNow, go to Service Desk > Incidents to see the resulting tickets!

Screen Shot 2024-04-04 at 2.51.39 PM.pngImage Removed

Component Workflow:

Expand
titleIguana notification data is parsed, processed, and posted to the ServiceNow Table API to create incident tickets

The notifier component contains the following workflow. This is easily adaptable based on your ticketing requirements:

  • Inbound Iguana notification data is parsed.

  • A short description for a ServiceNow incident ticket is created using the notification details.

    • A simple codemap is used to assign the appropriate ServiceNow priority levels given by the internal Iguana notification priority descriptions.

  • The SERVICENOW Library createTbRecord method is called to create a ticket in the specified ServiceNow table.

  • The resulting ServiceNow incident number or an error describing the failure is logged for visibility and troubleshooting.

The SERVICENOW Library:

Expand
titleSERVICENOWclient - sets up the adapter framework

Sets up the ServiceNow Notifier framework, adding the method modules to a metatable and storing the configurations from the custom fields in a table to call the API.

Expand
titleSERVICENOWauth - authenticates with the ServiceNow API authorization endpoint /oauth_token.do

The SERVICENOWauth function, builds and makes the HTTP POST token request to obtain the access token required for any resource requests against the FHIR Server.

A separate CreateJWT function creates the JSON Header and Payload components of the JWT and calls the OAUTH Library to sign and return the JWT required for the token request.

If the token requests is successful (HTTP 200 response), the token and token expiry returned are set to the Key and KeyExpiry custom fields respectively.

Expand
titleSERVICENOWcustom - makes API requests and returns the response

SERVICENOWcustom takes in any API requests and parameters to make the API call and return the response.

  • First the function checks if the token Key exists or has expired and performs the OAuth2.0 authentication workflow to obtain the token to be used in subsequent requests.

  • Uses the passed configurations API request parameters - the method (ex. post), ServiceNow API endpoint (ex. 'now/table/') and parameters for the call (ex. the incident ticket) - to build and carry out the appropriate HTTP request.

  • For resiliency, the Retry Library is used to retry any failed attempts and the response is handled and returned.

SERVICENOWcreateTbRecord prepares the arguments and calls SERVICENOWcustom to create an incident ticket in ServiceNow via HTTP POST request.store the returned access token and expiry time in an encrypted file for use on subsequent API requests.

image-20240417-151435.pngImage Added

Expand
titleStart the component or open the Translator to create the ticket and view the results
  1. Start the ServiceNow component or open the Translator to run the script. If running the script from the Translator, you will need to set the createTbRecord function call’s live parameter to true for the function to execute when viewing from the Translator

    image-20240417-180922.pngImage Added
  2. If running the script from within the Translator, you can check the created ticket from the results of the getTbRecord function

    image-20240417-180735.pngImage Added
  3. In ServiceNow, go to Service Desk > Incidents to see the resulting ticket!

image-20240417-153159.pngImage Added