ServiceNow Jira integration response status showing response as NaN but creating case in Jira.

Mahesh122
Tera Contributor

Hi all ,

 

I have integrated ServiceNow with Jira . When i create incident in ServiceNow corresponding case is getting created in Jira . But in return i am not getting response. when i see logs its showing as NAN but http status code i can see as 201 . can anyone help why i am nor receiving response? Below is the Br code

 

Table : Incident

Condition : subcategory changes to Jira issue

 

Code:

 

(function executeRule(current, previous /*null when async*/) {

// Add your code here
try {

var body = {
"update": {},
"fields": {
"summary": current.number + " - " + current.short_description.toString(),


"issuetype": {
"name": "Task" // Jira Incident
},
"project": {
"key": "MAH"
},


};

var string = JSON.stringify(body); //
var r = new sn_ws.RESTMessageV2('JIRA POC rest api', 'JIRA POC rest api post');
r.setRequestBody(string);
var response =r.execute();
var responseBody =response.getBody();
gs.log('Body is ', + responseBody);
var httpStatus = response.getStatusCode();
gs.log('httpstatus', + httpStatus);
current.update();

if(httpStatus == 201)
{
var body = JSON.parse(responseBody);
gs.log('Body is', + body);
current.correlation_id = body.id;
current.correlation_display = body.key;
}

}
catch(ex) {
var message = ex.message;
}
})(current, previous);

Thanks in advance.

1 REPLY 1

dhirennotani
Giga Expert

Hi @Mahesh122 ,

Hope you are doing well!

I this issue resolved for you, or are you still facing some issues with the integration.

I would recommend you to have a look at Exalate in the meantime, as it's a completely decentralized and bi-directional integration solution for integrating ServiceNow with Jira.

Thanks