Skip to main content

ServiceNow

Use the ServiceNow integration to streamline your incidents and respond to them automatically.

You should have ServiceNow set up as an IT Service Management/Ticket Management system to use the ServiceNow integration.

The integration between Spot Connect and ServiceNow lets you:

  • Trigger a workflow in Spot Connect, Ingest incidents as a trigger to Spot Connect workflows. (Fetch ServiceNow incidents into Spot Connect)
  • ServiceNow Create Incident - Create a new ServiceNow Incident
  • ServiceNow Delete Incident - Delete a specific ServiceNow Incident
  • ServiceNow Search Incidents - Get the incident list according to the supplied query
  • ServiceNow Update Incident - Update a specific ServiceNow Incident

Configure ServiceNow in Spot Connect

  1. In ServiceNow, create a user:
    • Make sure Password needs reset is not selected
    • Make sure Locked out is not selected
    • Select: Active
    • You can select Web service access only to make this user a non-interactive user
  2. In the Spot Console, go to Connect > Settings > Integrations.
  3. Click ServiceNow > Add Integration.
  4. Enter your ServiceNow instance URL, such as https://dev12345.service-now.com.
  5. Enter the username and password for the ServiceNow user you created.
  6. Click Add Instance.

Integration Action: ServiceNow Create

Creates a new incident in ServiceNow.

Input

Parameter NameDescriptionRequired
ServiceNow InstanceThe name of the ServiceNow IntegrationRequired
TableThe name of the table to update (e.g. “incident”)Required
CallerThe user creating the incident.Required
Short DescriptionThe title or brief description of the incident.Required
UrgencyHow long an incident can be delayed before significant impact.Optional
SeverityHow severe the incident.Optional
Assigned ToThe ServiceNow user assigned to the incident.Optional
CategoryServiceNow configurable category field.Optional
DescriptionA longer description of the incident.Optional
Due DateThe date the incident is due.Optional
Made SlaBoolean if the SLA was honored.Optional
Incident StateThe current state of the incident.Optional
ImpactServiceNow configurable Impact field value.Optional
NumberSystem generated unique incident number.Optional
PriorityThe priority of the incident.Optional
TemplateThe ID of a template to use to create the incident.Optional
StateThe current state of the incident.Optional

Output

Parameter NameTypeDescription
outputObjectJSON of the newly created incident.
execution_statusStringS_OK if successful, E_FAIL if errored.

Integration Action: ServiceNow Delete

Delete an incident in ServiceNow.

Input

Parameter NameDescriptionRequired
ServiceNow InstanceThe name of the ServiceNow Integration.Required
Sys idThe ID of the incident to delete.Required
TableThe ServiceNow table to delete from. (e.g. “incidents”)Required

Output

Parameter nameTypeDescription
resultObjectJSON response to the delete call.
execution_statusStringS_OK if successful, E_FAIL if an error was encountered.

Return the results of a ServiceNow query. You can save the non-truncated results to an S3 bucket.

ServiceNow operators available for filters and queries.

Input

Parameter NameDescriptionRequired
ServiceNow InstanceThe name of the ServiceNow Integration.Required
QueryQuery formatted per ServiceNow query syntax.Required
TableThe ServiceNow table to run the query against.Required
S3 BucketS3 bucket to save the full result list.Optional

Output

Parameter NameTypeDescription
resultJSON objectThe output of the query.
is_result_truncatedBooleanIf the result is too large (>~100k) the results will be truncated to the first 5 incidents.
result_bucket_keyStringIf an S3 bucket is specified, the path to the data.
s3_bucketStringThe bucket specified in the input.
execution_statusStringS_OK if successful, E_FAIL if an error was encountered.

Integration Action: ServiceNow Update

Update an incident in ServiceNow.

Input

Parameter NameDescriptionRequired
ServiceNow InstanceThe name of the ServiceNow Integration.Required
TableThe ServiceNow table to update.Required
Sys IdThe ID of the incident to updateRequired
Short DescriptionThe title or brief description of the incident.Required
UrgencyHow long an incident can be delayed before significant impact.Optional
SeverityHow severe the incident.Optional
Assigned ToThe ServiceNow user assigned to the incident.Optional
Caller IdThe ServiceNow ID of the person submitting the incident.Optional
CategoryServiceNow configurable category field.Optional
DescriptionA longer description of the incident.Optional
Due DateThe date the incident is due.Optional
Made SlaBoolean indicating if the SLA was honored.Optional
Incident StateThe current state of the incident.Optional
NumberSystem generated unique incident number.Optional
PriorityThe priority of the incident.Optional
TemplateThe ID of a template to use to create the incident.Optional
StateThe current state of the incident.Optional
CallerThe name of the person submitting the incident.Optional

Output

Parameter NameTypeDescription
resultJSON ObjectThe updated incident
execution_statusStringS_OK if successful, E_FAIL if an error was encountered.

Integration Action: ​ServiceNow Webhook Trigger

The integration node triggers the automatic execution of a workflow from a selected ServiceNow Category.

  1. Create an API key to use for ServiceNow webhooks.

  2. In the Spot console, select Connect > Workflows.

  3. Click New Workflow and enter a name for the workflow.

  4. Select trigger type ServiceNow > Create Workflow.

    View image
  5. In the center panel of the workflow builder, click the ServiceNow trigger node to open the right panel.

  6. In the Webhook API Key Name, select the API key you created earlier.

  7. Compose your workflow and save it.

  8. In the workflow builder, copy the Webhook API Key Value and the Workflow Webhook URL. When you configure the third-party application, use those saved values.

Setting up Webhook Trigger Action for ServiceNow

  1. Create an outbound REST message in ServiceNow:

    • Paste the webhook API key value in the Endpoint.
    • Set Authentication to No Authentication.
  2. Reopen the REST message.

  3. Create an HTTP method in ServiceNow:

    • Name it POSTCall
    • Select HTTP method POST
    • In HTTP Request, add these to the headers:
      • x-api-key: paste the webhook API key value
      • accept: application/json
      • content-type: application/json
    • In Content, paste in the sample JSON and add the fields from the incident table:
      {
      "sys_id":"${sys_id}",
      "number":"${number}",
      "short_description": "${short_description}",
      "urgency": "${urgency}",
      "description": "${description}",
      "impact": "${impact}",
      "state": "${state}",
      "instance_id":"${instance_id}"
      }
  4. Reopen the HTTP method.

  5. In Related Links, click Auto-generate variables > Update.

  6. Go to Business Rules > New.

  7. Enter a name and select a table.

  8. Select Active > Advanced.

  9. Enter this sample script and edit it to include your fields. Make sure:

    • YourOutboundRestCall is the name you gave in the outbound REST call
    • sn_ws.RESTMessageV2() is the name of your HTTP method
    (function executeRule(current, previous /*null when async*/ ) {
    // Add your code here
    function jsonEncode(str) {
    str = new JSON().encode(str);
    return str.substring(1, str.length - 1);
    }

    try {
    var r = new sn_ws.RESTMessageV2('YourOutboundRestCall', 'POSTCall');
    r.setStringParameter("sys_id", current.sys_id);
    r.setStringParameter("number", current.number);
    r.setStringParameter("short_description", current.short_description);
    r.setStringParameter("urgency", current.urgency);
    r.setStringParameter("description", jsonEncode(current.description + ''));
    r.setStringParameter("impact", current.impact);
    r.setStringParameter("state", current.state);
    r.setStringParameter("instance_id", gs.getProperty("instance_name"));

    var response = r.execute();
    var responseBody = response.getBody();
    var httpStatus = response.getStatusCode();
    gs.log("getBody: " + response.getBody());
    gs.log("getStatusCode: " + response.getStatusCode());
    gs.log("getHeaders " + response.getHeaders());
    } catch (ex) {
    var message = ex.message;
    }
    })(current, previous);
  10. On When to Run, select After > Insert.

  11. Click Submit.

When you create a new incident in the incident table, a call will be made to Spot Connect with the JSON you defined. The JSON will include the fields in the new incident.

You can create a new Spot Connect workflow and add the ServiceNow_Alert action to it.