Hello, I have a serverless app that creates an incident in serviceNow when I create a ticket in Freshdesk.
I am working on the onTicketUpdateCallback and need to extract the id of theincident created in SNOW that comes in the response body from ServiceNow ( in this case, service now calls it the “sys_id” property)
What is the proper way of doing this in a serverless app ?
here is an example of my simple serverless onTicketCreate event:
onTicketCreateCallback : function(args) {
let map = { this is node-transform where I have to transform the JSON to populate the service Now
incident table }
let headers = {headers info};
let body = JSON.stringify(map);
let options = {headers, body }
$request.post("endpoint",options);
.then(function(data) {
console.log('success' + JSON.stringify(data)); here is where i see the response JSON.
CODE TO EXTRACT ID PROPERTY? no matter what i do i seem to get Type error - Cannot get property of
'sys_id' Undefined or {}
},
function(err) {
console.log(err);
}
what is the common way for getting the json property from the response body in freshdesk?
Thank you