Integration of ServiceNow Field Service Management Software and NB.ai’s Route Optimization API

Introduction

ServiceNow® Field Service Management (FSM) stands out as a comprehensive solution in the constantly evolving landscape of service management, streamlining operations and fostering collaboration. ServiceNow's FSM, a single-platform powerhouse, improves scheduling and dispatching efficiency, optimizes workforce management, empowers field service teams, and elevates service delivery. FSM caters to a wide range of organizational needs, from integrated service to a robust partner ecosystem, self-service capabilities, territory planning, and project management.

NextBillion.ai's Route Optimization API is a powerful tool designed to revolutionize business route planning. The API ensures optimal route selection for fleets by taking into account factors such as time windows, capacity, and vehicle availability when addressing the Single and/or Multi-Vehicle Routing Problem (VRP).

NextBillion.ai's API, which consists of two key components - input data and the optimization engine - integrates seamlessly with ServiceNow's FSM. The input data contains relevant information about jobs, vehicles, and shipments. Using this data, the optimization engine determines the most efficient routes while taking into account complex constraints and variables.

This document will provide a step-by-step guide as we dive into the integration details, ensuring a seamless integration of ServiceNow's FSM and NextBillion.ai's Route Optimization API. Organizations can achieve unparalleled efficiency, time savings, and cost reductions in their field service operations by combining the strengths of these two powerful tools.

Prerequisites

The following prerequisites are mandatory requirements to ensure seamless integration between ServiceNow and NextBillion.ai.

  1. ServiceNow account with ServiceNow instance

  2. NextBillion.ai's API key: It is necessary to authenticate the API requests sent to the Route Optimization API.

These prerequisites lay the foundation for successful integration, facilitating the smooth exchange of data and functionalities between the two systems.

Integration Steps

This section outlines the integration steps for incorporating ServiceNow records into NextBillion's Route Optimization API using the Retool development suite, generating optimized routes by triggering Route Optimization API and visualizing the result using Optimization Tester.

Step 1: Setup Field Service Management Software


1. Create a ServiceNow Account

Establish a ServiceNow account to initiate the integration process.

2. Set up Field Service

  • Navigate to AllField ServiceAdministrationGuided Setup within your ServiceNow account.

  • Follow the guided setup to configure the database and populate relevant data records (e.g., user groups, field technicians, dispatchers, work order tasks).

docs-image

3. User Authentication

  • During guided setup, create a user with a specific user ID and password credentials.

  • Record the username and password as they serve for authentication in REST API calls outside the ServiceNow instance.

4. User Management

  • In ServiceNow, locate Users under AllOrganizationUsers.

  • Create a new user, assign a user ID, set a password, and assign necessary user roles (e.g., admin roles for comprehensive data access).

docs-image

5. API Connection Testing

Verify API connectivity using Postman to ensure seamless integration.

docs-image

Step 2: Retrieve Work Order Tasks

In this step, we retrieve work order tasks from the ServiceNow account. The objective is to pull a comprehensive list of work order tasks that provide essential details for further analysis and optimization.

docs-image

API Request

To fetch work order tasks from ServiceNow, use the following cURL command:

1
# Fetch work order tasks from ServiceNow
2
3
curl --location 'https://dev182540.service-now.com/api/now/table/wm_task?state=7'
4
--header 'Accept: application/json'
5
--header 'Authorization: Basic <your_authorization_value>'

API Response

The following API response contains a structured set of information, such as task details, associated links, and relevant attributes. This step lays the groundwork for subsequent actions.

1
{
2
"result": "[...]"
3
}

The following image displays the work order information accessible through the integration, allowing seamless visualization and manipulation within the Retool application.

docs-image

Step 3: Retrieve Dispatchers Information

To optimize routes based on vehicle capacity and other parameters, it's crucial to obtain a list of dispatchers, representing your vehicles.

docs-image

API Request

Execute the following cURL command to fetch dispatcher information from ServiceNow:

1
curl --location 'https://dev182540.service-now.com/api/now/table/sys_user'
2
--header 'Authorization: Basic <your_authorization_value>'

API Response

The API response returns a comprehensive list of dispatchers, which represent field service vehicles. Name, contact information, geolocation coordinates, and organizational affiliations are all included in each dispatcher entry. Attributes like gender, employee count, and user roles are also returned in the API response. This data is used to optimize routes based on vehicle capacity and other parameters, increasing the efficiency of field service management.

1
{
2
"result": "[...]"
3
}

The following image displays the dispatchers' data returned in the API response, presented on the Retool application, providing a user-friendly interface for further actions.

docs-image

Step 4: Data Preparation and Mapping

After successfully pulling the necessary data from ServiceNow, the data is mapped with the respective Route Optimization API parameters. Configure optimization settings such as shift start and end time, service time, and start and end location coordinates.

1
let vehicles = [];
2
let shifts = [];
3
let starts = [];
4
let ends = [];
5
let veh_attr = [];

Step 5: Create Optimization Job

In this step, the mapped data is sent to Route Optimization API to create an optimization job and response confirms the job creation and returns a unique job id.

API Request

The following cURL command sends a POST request to the Route Optimization API to create an optimization job.

1
curl --request POST \
2
--url https://api.nextbillion.io/optimization/v2?key={{localStorage.values.apiKey}}

API Response

The following API response confirms the creation of optimization job.

1
{
2
"id": "1a3905c5163dfc4aa5267e85c177ef7a",
3
"message": "Optimization job created",
4
"status": "Ok"
5
}

Step 6: Retrieve Optimized Route Result

Retrieve the optimized route result by making a GET request to the NextBillion.ai Route Optimization API with the job ID and API key.

API Request

1
https://api.nextbillion.io/optimization/v2/result?id={{nbaiOptimizationRun.data.id}}&key={{localStorage.values.apiKey}}

API Response

1
{
2
"result": {
3
"code": 0,
4
"summary": "{...}",
5
"routes": "[...]"
6
},
7
"status": "Ok",
8
"message": ""
9
}

Step 7: Visulaize Optimized Route Results

The optimized route results can be visulalized with the help of our Route Optimization Tester.

Use the following link to visualize the optimized routes.

1
https://playground.nextbillion.ai/optimization-tester?apiKey={{localStorage.values.apiKey}}&requestID={{nbaiOptimizationRun.data.id}}

The above link directs you to the Optimizer interface, providing a convenient way to inspect and analyze the optimized routes generated by the Route Optimization API. Simply replace the placeholders with your API key and the request ID obtained from the API response for seamless integration and route assessment. The following image visualizes the routes generated by the Route Optimization API within the Tester interface.

docs-image

ServiceNow and NextBillion.ai's Route Optimization API integration combines the strengths of a leading service management platform and cutting-edge route optimization technology. This integration enables organizations to improve their logistics and service delivery capabilities, resulting in operational excellence and, ultimately, a more agile and responsive business environment.

© 2024 NextBillion.ai all rights reserved.