Updating tickets from Smartsheet to Servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2020 05:00 AM
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.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 01:21 AM
Hi Varun,
Actually which method are you using in scripted REST API POST or PUT ?
can you post the code which you are using to capture the logs.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 02:21 AM
Hi Harish,
I am using POST method for scripted rest API.
Below is the code used in it
var reqbody = request.body;
var reqdata = reqbody.data;
gs.log("Sheet request data recieved from SS"+ JSON.stringify(reqdata));
var res = request.body.data.challenge;
response.setHeader('Smartsheet-Hook-Response', res);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 03:00 AM
Hi Varun,
Give the below piece of code and now again try updating the short description in the Smart sheet, Now in logs you should be able to see the Payload sent by the webhook
var parser = new JSONParser();
var parsedData = parser.parse(request.body.dataString);
gs.log(parsedData);
Hope this is Helpful.
Thankyou.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 05:10 AM
The recommended way to parse JSON data is to use the JavaScript native methods
var obj = JSON.parse(jsonString);
and the reverse to turn it from an object to a string
var str = JSON.stringify(obj);
Additionally, avoid using gs.log and gs.print as they are global only. Your code won't work if someone is writing a spoke for IntegrationHub, for example. gs.debug/gs.info/gs.warn/gs.error work in both global and scope. Use those instead and you'll avoid scoping issues later. 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 06:10 AM
Thank you