> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rootly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ServiceNow

> Connect ServiceNow to Rootly for bidirectional incident sync — create and update ServiceNow incidents from workflows, and receive ServiceNow events as alerts.

The ServiceNow integration connects Rootly with your ServiceNow instance bidirectionally. Rootly can create and update ServiceNow incidents through workflow actions, and ServiceNow can send incident events to Rootly as alerts using Business Rules.

With the ServiceNow integration, you can:

* Automatically create ServiceNow incidents from Rootly incidents
* Update ServiceNow incident priority, state, and custom fields as incidents evolve
* Receive ServiceNow incident events as Rootly alerts to trigger on-call paging
* Sync ServiceNow CMDB business applications to Rootly services

## Before You Begin

Before setting up the integration, make sure you have:

* A Rootly account with admin permission to manage integrations
* A ServiceNow instance with admin access
* Permission to create OAuth Application Registry entries in ServiceNow

<Info>
  Rootly recommends installing with a dedicated ServiceNow service account so the integration does not break if an individual user leaves your organization.
</Info>

## Installation

<Steps>
  <Step title="Open the ServiceNow integration in Rootly" icon="plug">
    Log into Rootly as an Admin and navigate to **Configurations > Integrations > ServiceNow**. Click **Setup**.

    <img src="https://mintcdn.com/rootly/6qP0tS1GNk4jbxrs/images/integrations/servicenow/servicenow-setup-modal.webp?fit=max&auto=format&n=6qP0tS1GNk4jbxrs&q=85&s=45848eae128419626a34d4088d496281" alt="ServiceNow setup modal in Rootly" width="877" height="420" data-path="images/integrations/servicenow/servicenow-setup-modal.webp" />
  </Step>

  <Step title="Create an OAuth Application in ServiceNow" icon="key">
    Log into your ServiceNow instance as an Admin and navigate to **System OAuth > Application Registry**.

    <img src="https://mintcdn.com/rootly/6qP0tS1GNk4jbxrs/images/integrations/servicenow/servicenow-system-oauth-menu.webp?fit=max&auto=format&n=6qP0tS1GNk4jbxrs&q=85&s=293375294574916c4891b20d965b71ae" alt="ServiceNow System OAuth menu" width="594" height="439" data-path="images/integrations/servicenow/servicenow-system-oauth-menu.webp" />

    Click **New**, then select **Create an OAuth API endpoint for external clients**.

    <img src="https://mintcdn.com/rootly/6qP0tS1GNk4jbxrs/images/integrations/servicenow/servicenow-oauth-endpoint-selection.webp?fit=max&auto=format&n=6qP0tS1GNk4jbxrs&q=85&s=cb441f2e8b2a1a58eecac445c47730f4" alt="Selecting the OAuth API endpoint type in ServiceNow" width="1038" height="279" data-path="images/integrations/servicenow/servicenow-oauth-endpoint-selection.webp" />

    Fill in the following fields and click **Submit**:

    | ServiceNow Field | Value                                          |
    | ---------------- | ---------------------------------------------- |
    | `Name`           | `Rootly`                                       |
    | `Redirect URL`   | `https://rootly.com/auth/service_now/callback` |

    <img src="https://mintcdn.com/rootly/6qP0tS1GNk4jbxrs/images/integrations/servicenow/servicenow-oauth-application-form.webp?fit=max&auto=format&n=6qP0tS1GNk4jbxrs&q=85&s=ac363368ad072857c031e5d9e09da5d1" alt="ServiceNow OAuth application registration form" width="1582" height="610" data-path="images/integrations/servicenow/servicenow-oauth-application-form.webp" />
  </Step>

  <Step title="Copy credentials from ServiceNow to Rootly" icon="copy">
    Open the application you just created in ServiceNow and copy the **Client ID** and **Client Secret**.

    <img src="https://mintcdn.com/rootly/6qP0tS1GNk4jbxrs/images/integrations/servicenow/servicenow-client-credentials.webp?fit=max&auto=format&n=6qP0tS1GNk4jbxrs&q=85&s=577805cc7885234274760d74b87ab1af" alt="ServiceNow client ID and client secret fields" width="1266" height="671" data-path="images/integrations/servicenow/servicenow-client-credentials.webp" />

    <Warning>
      When copying the **Client Secret**, you may need to unmask it by clicking the lock icon. Masked values sometimes do not copy correctly in ServiceNow.
    </Warning>

    Paste the Client ID, Client Secret, and your ServiceNow instance URL into the Rootly setup modal and click **Connect**.

    <img src="https://mintcdn.com/rootly/6qP0tS1GNk4jbxrs/images/integrations/servicenow/rootly-servicenow-connection-form.webp?fit=max&auto=format&n=6qP0tS1GNk4jbxrs&q=85&s=e2653262da5998695443d59113b1423e" alt="Rootly ServiceNow connection form" width="878" height="426" data-path="images/integrations/servicenow/rootly-servicenow-connection-form.webp" />
  </Step>

  <Step title="Authorize Rootly in ServiceNow" icon="circle-check">
    You will be redirected to ServiceNow to authorize the connection. Click **Allow**.

    <img src="https://mintcdn.com/rootly/6qP0tS1GNk4jbxrs/images/integrations/servicenow/servicenow-oauth-authorization.webp?fit=max&auto=format&n=6qP0tS1GNk4jbxrs&q=85&s=70e8ce06b088eaa34a88c7cb3fba1283" alt="ServiceNow OAuth authorization prompt" width="906" height="475" data-path="images/integrations/servicenow/servicenow-oauth-authorization.webp" />

    <Check>
      After authorization, the **Create a ServiceNow Incident** and **Update a ServiceNow Incident** workflow actions are available in your Genius workflows.
    </Check>
  </Step>
</Steps>

## Ingest ServiceNow Events

To receive ServiceNow incident events as Rootly alerts, configure a Business Rule in ServiceNow to send events to Rootly's webhook endpoint.

<Steps>
  <Step title="Get your webhook URL and secret from Rootly" icon="link">
    In Rootly, open the ServiceNow integration settings. Copy the **Webhook URL** and **Secret** values shown on the integration page.
  </Step>

  <Step title="Create a Business Rule in ServiceNow" icon="code">
    In ServiceNow, navigate to **System Definition > Business Rules**.

    <Info>
      There are multiple Business Rules pages in ServiceNow. Make sure you select the one under **System Definition**.
    </Info>

    Click **New** and fill in:

    | Field      | Value                                                |
    | ---------- | ---------------------------------------------------- |
    | `Name`     | Any descriptive name (for example, `Send to Rootly`) |
    | `Table`    | `Incident [incident]`                                |
    | `Advanced` | Check this                                           |
    | `When`     | `After`                                              |
    | `Insert`   | Check to receive events when incidents are created   |
    | `Update`   | Check to receive events when incidents are updated   |
    | `Delete`   | Check to receive events when incidents are deleted   |

    <img src="https://mintcdn.com/rootly/6qP0tS1GNk4jbxrs/images/integrations/servicenow/servicenow-business-rule-advanced-tab.webp?fit=max&auto=format&n=6qP0tS1GNk4jbxrs&q=85&s=794f604c4e157b03891e9c1c7a640551" alt="ServiceNow Business Rule advanced tab" width="974" height="824" data-path="images/integrations/servicenow/servicenow-business-rule-advanced-tab.webp" />

    Navigate to the **Advanced** tab and replace the script with the following:

    ```js theme={null}
    (function executeRule(current, previous /*null when async*/ ) {
        try {
            var r = new sn_ws.RESTMessageV2();
            r.setEndpoint("<insert webhook public URL>");
            r.setHttpMethod("post");
            r.setRequestHeader("secret", "<secret>");

            var usr = new GlideRecord('sys_user');
            usr.get('sys_id', current.getValue("caller_id"));
            var reported_by_email = usr.getValue('email');

            var number = current.getValue("number");
            var opened_at = current.getValue("opened_at");
            var impact = current.getValue("impact");
            var urgency = current.getValue("urgency");
            var short_description = current.getValue("short_description");
            var description = current.getValue("description");
            var category = current.getValue("category");
            var priority = current.getValue("priority");
            var sys_id = current.getValue("sys_id");
            var subcategory = current.getValue("subcategory");
            var state = current.getValue("state");

            var obj = {
                "number": number,
                "reported_by_email": reported_by_email,
                "opened_at": opened_at,
                "impact": impact,
                "urgency": urgency,
                "short_description": short_description,
                "description": description,
                "category": category,
                "priority": priority,
                "sys_id": sys_id,
                "subcategory": subcategory,
                "state": state
            };

            var body = JSON.stringify(obj);
            r.setRequestBody(body);

            var response = r.execute();
            var httpStatus = response.getStatusCode();
        } catch (ex) {
            var message = ex.message;
            gs.error("Error message: " + message);
        }

        gs.info("Webhook target HTTP status response: " + httpStatus);

    })(current, previous);
    ```

    Replace `<insert webhook public URL>` and `<secret>` with the values from the Rootly ServiceNow integration page.

    <img src="https://mintcdn.com/rootly/6qP0tS1GNk4jbxrs/images/integrations/servicenow/servicenow-webhook-configuration.webp?fit=max&auto=format&n=6qP0tS1GNk4jbxrs&q=85&s=2c0ed80a67d3a18ceeb5477b0e0c40a7" alt="ServiceNow webhook configuration" width="880" height="801" data-path="images/integrations/servicenow/servicenow-webhook-configuration.webp" />

    Click **Submit**.
  </Step>
</Steps>

### How Alerts Are Mapped

Each ServiceNow event received creates a Rootly alert with the following fields:

| Rootly Alert Field | ServiceNow Source                                      |
| ------------------ | ------------------------------------------------------ |
| Summary            | `short_description`, then `description`, then `number` |
| External ID        | `sys_id`                                               |
| External URL       | `url` (if provided in payload)                         |

Alert labels:

| Label         | ServiceNow Field |
| ------------- | ---------------- |
| `id`          | `sys_id`         |
| `number`      | `number`         |
| `impact`      | `impact`         |
| `urgency`     | `urgency`        |
| `category`    | `category`       |
| `subcategory` | `subcategory`    |
| `state`       | `state`          |

### Using ServiceNow as an Alert Source

If your org uses Rootly On-Call, ServiceNow alerts can be used to page on-call users. Once the Business Rule is configured, alerts from ServiceNow will appear in your Rootly alert feed and can trigger on-call notifications through alert workflows.

<iframe width="640" height="360" src="https://www.loom.com/embed/c129a02a6c0c409987b873f551c6f09c?sid=c4b29bbb-50d9-4063-a2c2-ca5f02c89776" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen />

## Workflow Actions

The ServiceNow integration provides workflow actions for creating and updating ServiceNow incidents from Rootly. If you are unfamiliar with how Genius workflows work, visit the [Workflows](/workflows/workflows) documentation first.

### Create a ServiceNow Incident

This action creates a new record in the ServiceNow `Incident` table (for example, `INC0010001`) and links it to the Rootly incident.

| Field                     | Description                                                                                                   | Required |
| ------------------------- | ------------------------------------------------------------------------------------------------------------- | -------- |
| **Name**                  | Display name for this workflow action                                                                         |          |
| **Title**                 | Maps to `short_description` in ServiceNow. Supports Liquid                                                    | Yes      |
| **Description**           | Maps to `description` in ServiceNow. Supports Liquid                                                          |          |
| **Priority**              | Maps to `urgency`. **Auto** mirrors the incident severity                                                     |          |
| **Status**                | Maps to `state`. **Auto** mirrors the incident status                                                         |          |
| **Acts As User**          | Name or email of the ServiceNow user to set as caller when resolving. Only active when status is Resolved (6) |          |
| **Custom Fields Mapping** | JSON of additional ServiceNow fields. Merged directly into the incident payload. Supports Liquid              |          |

**Priority mapping (Auto)**

| Rootly Severity | ServiceNow Urgency |
| --------------- | ------------------ |
| Critical        | High (1)           |
| High            | High (1)           |
| Medium          | Medium (2)         |
| Low             | Low (3)            |

**Status mapping (Auto)**

| Rootly Status | ServiceNow State |
| ------------- | ---------------- |
| Started       | New (1)          |
| Mitigated     | In Progress (2)  |
| Resolved      | Resolved (6)     |

Available states: New (1), In Progress (2), On Hold (3), Resolved (6), Closed (7), Canceled (8).

<Info>
  **Acts As User** triggers a ServiceNow user lookup by first name, last name, or email. When matched, Rootly sets `caller_id`, `close_code`, and `close_notes` automatically. It only applies when the state is set to Resolved (6).
</Info>

<Frame>
  <img alt="Create a ServiceNow Incident workflow action configuration form" src="https://mintcdn.com/rootly/6qP0tS1GNk4jbxrs/images/integrations/servicenow/workflows/images-1.webp?fit=max&auto=format&n=6qP0tS1GNk4jbxrs&q=85&s=4b840ce00f1404be3c22ac5d45e7d30d" width="914" height="1372" data-path="images/integrations/servicenow/workflows/images-1.webp" />
</Frame>

### Update a ServiceNow Incident

This action updates an existing record in the ServiceNow `Incident` table.

<Info>
  When a **Create a ServiceNow Incident** action runs, Rootly stores the resulting `sys_id` and incident number on the incident record. Reference them in subsequent update actions using Liquid variables.
</Info>

| Field                     | Description                                                    | Required |
| ------------------------- | -------------------------------------------------------------- | -------- |
| **Name**                  | Display name for this workflow action                          |          |
| **Incident ID**           | ServiceNow `sys_id` of the incident to update. Supports Liquid | Yes      |
| **Title**                 | Updated `short_description`. Supports Liquid                   |          |
| **Description**           | Updated `description`. Supports Liquid                         |          |
| **Priority**              | Updated urgency level                                          |          |
| **Status**                | Updated incident state                                         |          |
| **Acts As User**          | Name or email of the caller to set when resolving              |          |
| **Custom Fields Mapping** | Updated custom field values as JSON. Supports Liquid           |          |

<Frame>
  <img alt="Update a ServiceNow Incident workflow action configuration form" src="https://mintcdn.com/rootly/6qP0tS1GNk4jbxrs/images/integrations/servicenow/workflows/images-2.webp?fit=max&auto=format&n=6qP0tS1GNk4jbxrs&q=85&s=cd95ef9e238150c9e2bf0c5fefeaa052" width="915" height="1373" data-path="images/integrations/servicenow/workflows/images-2.webp" />
</Frame>

### Common Custom Field Examples

**Work notes (internal)** — visible only to ServiceNow agents, not customers.

```json theme={null}
{
  "work_notes": "{{ incident.events[0].event_raw }}"
}
```

**Comments (customer-visible)**

```json theme={null}
{
  "comments": "{{ incident.events[0].event_raw }}"
}
```

**Major incident**

```json theme={null}
{
  "assignment_group": "3De45d9ebc3b333200fe02c9bb34efc434",
  "major_incident_state": "proposed"
}
```

<Warning>
  Major incident state changes may require specific ACL permissions in ServiceNow. See the [ServiceNow community](https://community.servicenow.com/community?id=community_question\&sys_id=fae73aeb1b7370900b8a9979b04bcb1a) for details.
</Warning>

### Add Configuration Items (CIs) to an Incident

Adding configuration items to a ServiceNow incident requires multiple API calls (one per CI). Use Rootly's **HTTP Client** workflow action with the ServiceNow Batch API to consolidate them into a single request.

<Frame>
  <img alt="HTTP Client workflow action configured for the ServiceNow Batch API" src="https://mintcdn.com/rootly/6qP0tS1GNk4jbxrs/images/integrations/servicenow/workflows/images-3.webp?fit=max&auto=format&n=6qP0tS1GNk4jbxrs&q=85&s=7ee06615261d903365c761401a9d5ac5" width="877" height="2071" data-path="images/integrations/servicenow/workflows/images-3.webp" />
</Frame>

**Endpoint**

```http theme={null}
POST https://<instance-domain>.com/api/now/v1/batch
```

**Headers**

```json theme={null}
{
  "Accept": "application/json",
  "Content-Type": "application/json",
  "Authorization": "Basic {{ secrets.service_now_key_encoded }}"
}
```

<Tip>
  Store your Base64-encoded `username:password` as a [Rootly Secret](https://rootly.com/account/secrets) to keep credentials out of plain-text workflow configurations.
</Tip>

**Body**

Each individual Table API call must have its `body` Base64-encoded. The following Liquid template dynamically generates one batch entry per service associated with the incident:

```json theme={null}
{
  "batch_request_id": "1",
  "rest_requests": [
{% for service in genius_workflow_run.newly_added_services %}
{% assign task_value = incident.service_now_incident_id %}
{% assign ci_item_value = service | get: 'service_now_ci_sys_id' %}
{% assign body_string = '{ "task": "' | append: task_value | append: '", "ci_item": "' | append: ci_item_value | append: '" }' %}
    {
      "id": "1{{ forloop.index }}",
      "headers": [{ "name": "Content-Type", "value": "application/json" }],
      "url": "/api/now/table/task_ci",
      "method": "POST",
      "body": "{{ body_string | base64_encode }}"
    }{% unless forloop.last %},{% endunless %}
{% endfor %}
  ]
}
```

<Info>
  To use this template, each ServiceNow CI's `sys_id` must be linked to the equivalent Rootly service using the `service_now_ci_sys_id` field.
</Info>

**Succeed On Status** — set to `200`. The ServiceNow Batch API returns `200` (not `201`) on success.

## Uninstall

To remove the ServiceNow integration, navigate to **Configuration > Integrations > ServiceNow > Delete**.

## Related Resources

* [Workflows](/workflows/workflows)
* [Alert workflows](/workflows/alert-workflows)
* [Integrations overview](/integrations/overview)
