Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to get incident create into jira from servicenow to jira getting error

Tharun k
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 12, 2021

I am trying to get incident create into jira from servicenow to jira getting error

when incident record created in servicenow then record created into Jira.

error message is:{"errorMessages":["Unexpected character ('b' (code 98)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@210a550f; line: 1, column: 2]"]}

 

Business rule script : servicenow side 

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

//var body = "{\"fields\": {\"project\":{\"key\": \"Servicenow Porject\"},\"summary\": \"This is jira demo.\",\"issuetype\": {\"name\": \"incident\"}}}";

var body="{\"fields\":{\"project\":{\"key\":\"Servicenow Porject\"},\"summary\":\"This is JIRA demo summary\",\"description\": \"Demo JIRA description\",\"issuetype\": {\"name\":\"incident\"}}}";
var request= new sn_ws.RESTMessageV2();
request.setEndpoint('https://tharun1245.atlassian.net/rest/api/3/issue');
request.setHttpMethod('POST');
request.setRequestBody('body');

var user = 'kumarservice7@gmail.com';
var password = '**************';

request.setBasicAuth(user,password);
request.setRequestHeader("Accept", "application/json");
request.setRequestHeader("Content-Type", "application/json");

var response = request.execute();
gs.log('jira status:' + response.getBody());

})(current, previous);

 

how correct this please help on this

 

Regards,

Tharun

1 answer

0 votes
Hana Kučerová
Community Champion
May 13, 2021

Hi @Tharun k ,

welcome to the Atlassian community!

First of all I strongly advice you to edit your post and remove the password, because this is public site and anybody can see it.

I've found this article, did you use it for inspiration?

I cannot tell you, if the concept works, because I don't work with Servicenow, but what I can see after the quick check, that project key is definitely not right, "Servicenow Porject" is probably the name of the project, not the key.

Then also this row doesn't seem right.

request.setRequestBody('body');

 It probably should be

request.setRequestBody(body);

because you want to use your variable instead of string.

Also the description param in the body doesn't seem to be in the correct format, so I would recommend you to remove it for now.

Suggest an answer

Log in or Sign up to answer