The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Updating tickets from Smartsheet to Servicenow

varunkumar1
Tera Contributor

Hi Team,

I have integrated Servicenow (incident table)with Smart sheet.

On creating incident ticket on servicenow instance, integration triggers and creates a smart sheet and copies incident record data into smart sheet. 

Now I am looking for reverse integration i.e on updating incident record in smart sheet, it should update respective incident ticket in servicenow. Please help me with your ideas.

 

 

 

14 REPLIES 14

Hi Varun
I have requirement like integrate servicenow with smart sheet how we integrate any documention that you can please guide me 

Arif Mansuri
Tera Contributor

Hi ,

 

I am integrating ServiceNow with Smartsheet. Can you tell me whenever any update happens in Smartsheet, how do we get the data/changes in ServiceNow

SasankaV
Mega Guru

Set Up a Webhook in Smartsheet

  1. Log in to your Smartsheet account.
  2. Go to the sheet where the incident records are stored.
  3. Create a webhook to trigger when rows are updated:
    • Navigate to the Smartsheet Developer Tools.
    • Register a new webhook with the URL pointing to the ServiceNow Scripted REST API endpoint.
    • Set the scope to listen for row updates.

Create an API Endpoint in ServiceNow

  1. In ServiceNow, navigate to System Web Services > Scripted REST APIs.

  2. Click New to create a new Scripted REST API.

  3. Define the API with a resource that will handle the updates:

 

var SmartsheetUpdateAPI = Class.create();
SmartsheetUpdateAPI.prototype = {
    initialize: function() {},

    updateIncident: function(request, response) {
        var requestBody = request.body.data;
        var incidentSysId = requestBody.sys_id; // Assuming sys_id is passed from Smartsheet
        var incidentGr = new GlideRecord('incident');
        
        if (incidentGr.get(incidentSysId)) {
            incidentGr.short_description = requestBody.short_description; // Map other fields as needed
            incidentGr.update();
            response.setStatus(200);
            response.setBody({status: 'success', message: 'Incident updated successfully'});
        } else {
            response.setStatus(404);
            response.setBody({status: 'failure', message: 'Incident not found'});
        }
    },

    type: 'SmartsheetUpdateAPI'
};

 

      4. In the API definition, create a resource with the path /updateIncident and set the HTTP method to POST.

Map Data Between Smartsheet and ServiceNow

  • Ensure that the webhook payload from Smartsheet includes all the necessary fields to identify and update the incident in ServiceNow. Typically, you’ll need the sys_id of the incident and any fields that may be updated, like short_description, priority, etc.

Handle Webhook Requests in ServiceNow

  1. When the webhook triggers, it sends a POST request to the ServiceNow Scripted REST API.
  2. The updateIncident method processes the request:
    • It extracts the sys_id and other fields from the request body.
    • It uses the sys_id to fetch and update the corresponding incident record in ServiceNow.
  3. The response is sent back to Smartsheet to confirm whether the update was successful or not.

An example webhook payload:

 

{
    "sys_id": "1234567890abcdef1234567890abcdef",
    "short_description": "Updated description from Smartsheet",
    "priority": "2",
}

 

Example cURL command to test:

 

curl -X POST https://your_instance.service-now.com/api/now/smartsheet/updateIncident \
     -H "Content-Type: application/json" \
     -d '{
           "sys_id": "1234567890abcdef1234567890abcdef",
           "short_description": "Updated description from Smartsheet",
           "priority": "2"
         }' \
     -u 'your_username:your_password'

 

 

SasankaV
Mega Guru

 

  • First, ensure you have the necessary permissions and access in both ServiceNow and SmartSheet.
  • Explore SmartSheet's automation or scripting capabilities to trigger actions based on changes in the sheet.
  • Set up a script or automation rule in SmartSheet to detect changes to incident records.
  • When a change is detected, use SmartSheet's API to send a notification or trigger an action in ServiceNow.
  • In ServiceNow, create a corresponding script or integration to receive updates from SmartSheet.
  • Use ServiceNow's REST API to update the respective incident ticket based on the received data.
  • Test the integration thoroughly to ensure it works as expected.

 

Sampathr382
Tera Contributor

Hi @varunkumar1 

 

May I know how you have achieved integration between service now and smartsheet i.e., whenever incident is created in servicenow the same data is sent to smartsheet. Can you please explain in detail?

 

Thank you 👍