ServiceNow account details

To establish a connection to ServiceNow, you must add an account that defines the account details to connect with. You can define these details by creating a configuration object in the App Connect Dashboard, the Red Hat® OpenShift® web console or CLI, or the Kubernetes CLI.

Support considerations

  • If you want to create a free ServiceNow account to test out App Connect, you’ll have to register for a ServiceNow Account for the Developer Site. After your account is activated, you can request a ServiceNow personal developer instance.
  • If you are using a ServiceNow instance at the London release (or earlier), upgrade your instance to the Madrid release or later. (At the time of writing, App Connect flows have been verified using instances up to the ServiceNow Orlando release.) For more information about upgrading an instance, see the ServiceNow documentation.

Account parameters

You can define one or more accounts for ServiceNow.

For each account that you require, you can specify a new set of account details in any of the following ways:

  • If you are using the App Connect Dashboard, either complete the Account details fields in the Create configuration panel, or specify the account parameters in an accounts.yaml file before importing it into the Create configuration panel. For more information, see Accounts type.
  • If you are using the Red Hat OpenShift web console or CLI, or the Kubernetes CLI, specify the account parameters in an accounts.yaml file, and then use this configuration file to create a configuration object. For more information, see Creating the file for a configuration object of type Accounts.

The set of required and optional Account fields or parameters are listed in the following table.

For information about locating the values for these account parameters, see Locating the values for the account parameters.

Field Parameter Values Condition Description

Account name

name

User defined

Required

The name of a ServiceNow account that is used in the exported flow.

Authentication type

authType

OAUTH2_WEB

Optional

The mechanism that is used for user authorization.

API version

apiVersion

Optional

The version of ServiceNow REST APIs being used to make API calls. If you need to use a specific version (for example, version 1) you can specify it as follows: apiVersion: "v1". Otherwise, you can omit this parameter.

User name

accessToken

User defined

Required

An OAuth access token that is used (in place of user credentials) to gain access to ServiceNow when making API calls. Specify the access token that you generated in Postman.

Password

refreshToken

User defined

Required

A refresh token that can be used to obtain a new access token without a need for user intervention. Specify the refresh token that you generated in Postman.

Client ID

clientId

User defined

Required

The client ID that you generated under System OAuth > Application Registry in ServiceNow.

Client secret

clientSecret

User defined

Required

The client secret that you generated under System OAuth > Application Registry in ServiceNow.

URL

url

User defined

Required

The URL of your ServiceNow instance.

Locating the values for the account parameters

If necessary, work with your ServiceNow administrator to obtain the values for the account parameters.

To obtain connection values for ServiceNow, complete the following steps:

  1. Create an OAuth application endpoint that can be used to access the ServiceNow instance. This process generates a client ID and client secret that you’ll require to establish a connection.
    1. Log in to your ServiceNow instance using your assigned user name and password. This user must be assigned the itil and soap roles to allow access to the features and capabilities required by App Connect. Your ServiceNow administrator should be able to assign these roles to your user account.

      If you are using a ServiceNow personal developer instance and access your instance using the default admin account for the System Administrator profile, you should already have the required access because this account is automatically assigned the admin role, which provides access to all features and capabilities.

    2. Follow these instructions in the ServiceNow documentation to obtain a client ID and client secret: Create an endpoint for clients to access the instance.
      Important:
      • Ensure that you add this callback URL to the Redirect URL field because you’ll need to use the Postman utility to generate an access token and a refresh token:
        https://www.getpostman.com/oauth2/callback
      • You might also find it helpful to increase the Access Token Lifespan value to the value of Refresh Token Lifespan to increase the period before enforced user sign-ins.

    If you have a current ServiceNow account in your App Connect on IBM® Cloud instance, you can use the OAuth application endpoint that you configured for this account, but will need to update your Application Registry settings to add the Postman callback URL. From your ServiceNow instance, navigate to System OAuth > Application Registry, click the relevant name, and then update the Redirect URL field to add the https://www.getpostman.com/oauth2/callback callback URL. (You might also want to increase the Access Token Lifespan value to the value of Refresh Token Lifespan to increase the period before enforced user sign-ins.)

    Redirect URL field in ServiceNow
  2. Use Postman to generate an access token and a refresh token. Postman will use these tokens to interact with ServiceNow on your behalf. (Postman Version 7.13 was used in these instructions, so there might be a slight variation in the fields that you see if your version is different.)
    1. Configure a new GET request for this ServiceNow API call:
      https://instance.service-now.com/api/now/table/incident

      Where instance represents your instance name. For example, if your instance URL is https://dev12345.service-now.com/, instance would be dev12345.

      GET request in Postman
    2. From the Authorization tab, set Type to OAuth 2.0 and then click Get New Access Token.
      Authorization tab in Postman
    3. Complete the Get New Access Token window as follows:
      • Token Name: Specify a descriptive name for the token.
      • Grant Type: Select Authorization Code.
      • Callback URL: Set this to the value specified under System OAuth > Application Registry in ServiceNow: https://www.getpostman.com/oauth2/callback.
      • Auth URL: Set this to https://instance.service-now.com/oauth_auth.do, where instance represents your instance name.
      • Access Token URL: Set this to https://instance.service-now.com/oauth_token.do, where instance represents your instance name.
      • Client ID: Specify the client ID generated under System OAuth > Application Registry in ServiceNow.
      • Client Secret: Specify the client secret generated under System OAuth > Application Registry in ServiceNow.
      • Scope: Set this to useraccount.
      • State: Accept the default value.
      • Client Authentication: Accept the default value.
      • Request access token locally: If shown in your version of Postman, select this check box.
      Generating tokens in Postman
    4. Click Request Token and then log in to ServiceNow when prompted.
      ServiceNow login panel
    5. Click Allow to authorize Postman to interact with your ServiceNow instance.
      Authorize Postman to interact with ServiceNow
    6. Return to Postman to view the generated tokens in the Manage Access Tokens window.
      Generated tokens in Postman
    7. Click Use Token to assign the token to your GET request. You should be able to view all the tokens you’ve created.
      View tokens generated for a request
    8. Verify that the token can be used to successfully make a GET call to ServiceNow by clicking Send. You should see the response in Postman.
      ServiceNow response for a GET call

Example

Remember: An accounts.yaml file that defines one or more accounts must always begin with the following line:
accounts:

servicenow:
    - name: "Account 1"
      credentials:
          authType: "OAUTH2_WEB"
          accessToken: "3FrEDDYjlp07TREyuiuuo5678YTRMjkrowqrkpQlIgmCkqaS9-9kltoqdGVCXS42LMPDg"
          refreshToken: "qOlflkoiDCVBeffpojor-uBh_eda9-yzLKVtryuquiu543ythD_RfS"
          clientId: "ab79a9876599c033044538b00d2"
          clientSecret: "JoHNNme}doe59"
      endpoint:
          url: "https://dev12345.service-now.com/"