Overview

ServiceNow Integration allows you to:

  • Automatically create an incident in ServiceNow upon creation of Rootly incident.
  • Automatically update an existing incident in ServiceNow upon updates on Rootly incident.
  • Automatically create incident in Rootly upon creation of ServiceNow incident.
  • Automatically update an existing incident in Rootly upon updates on ServiceNow incident.
  • Automatically page on-call user upon creation of ServiceNow incident.

Establish Write-Access to ServiceNow

Rootly integrates to ServiceNow via OAuth - enabling Rootly to create and update the INC table in ServiceNow.

It is recommended that you perform this integration using a service account to ensure uninterrupted connection, should the integrating user leave the company.

Log into your Rootly org as an Admin user and navigate to Configurations > Integrations > ServiceNow.

Click Setup to open configuration modal.

Log into your ServiceNow instance as an Admin user and navigate to **System OAuth **>Application Registry .

Click on New to initiate the creation of a new application.

Select the Create an OAuth API endpoint for external clients option.

Copy and paste the following values to the corresponding fields in ServiceNow and then click on Submit.

ServiceNow FieldValue
NameRootly
Redirect URLhttps://rootly.com/auth/service_now/callback

Locate and open the new application you just created in ServiceNow. You might have to search for it by Name if you have a lot of applications already.

Copy following fields from ServiceNow.

When copying the Client Secret, you might have to unmask (click on the lock icon) it and perform a manual drag > right click > Copy. Sometimes masked values do not copy correctly in ServiceNow.

Paste the copied fields into your Rootly setup modal and click on Connect.

You’ll be presented with a ServiceNow screen to proceed with the integration. Click on Allow.

If integration is successful, you’ll be presented with this screen on Rootly.

You can click on Save and you are all set! Your ServiceNow card should appear with a Connected indicator when you’re on the Integrations page.

Establish Ability to Receive ServiceNow Events

Webhooks are set up in ServiceNow to send incident events to Rootly. Rootly is then able to process these events to facilitate automated actions.

Navigate to your ServiceNow instance and go to **System Definition **>Business Rules .

There are multiple Business Rules pages. Make sure you select the one under System Definition.

Click on New to initiate the creation a new business rule.

Fill in the following fields.

ServiceNow FieldValue
NameGive it any descriptive name you’d like.
TableSelect Incident [incident].
AdvancedEnsure this is checked.
WhenSelect After.
InsertCheck this if you want to receive an event after an incident is created in ServiceNow.
UpdateCheck this if you want to receive an event after an incident is updated in ServiceNow.
DeleteCheck this if you want to receive an event after an incident is deleted in ServiceNow.

Navigate to the Advanced tab.

Replace content in the Script editor with the following code.

(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>");

        // getValue(string) does not support dot walking, 
        // so I had to do a bit more to get the user’s email address
        var usr = new GlideRecord('sys_user');
        usr.get('sys_id', current.getValue("caller_id"));
        var reported_by_email = usr.getValue('email');

        // Make sure to convert object references to values.
        // More info at: 
        // https://swissbytes.blogspot.com/2017/11/service-now-script-includes-make-sure.html

        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);
        gs.info("Webhook body: " + body);
        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> placeholder texts with actual values from Rootly’s ServiceNow integration page.

Click Submit. Now you’re ready to receive ServiceNow events in Rootly!

Uninstall

You can uninstall this integration by navigating to Configuration > Integrations > **ServiceNow **>Delete.

Using ServiceNow as an Alert Source

If your org is using Rootly On-Call, ServiceNow can also be set up as an alert source. This allows your on-call user to be paged whenever a ServiceNow ticket is created.

You Rootly org must have Rootly On-Call enabled order to perform this setup.

Support

If you need help or more information about this integration, please contact support@rootly.com.