How send attachment from ServiceNow to JIRA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 11:52 PM
Hi All,
I am trying to send an attachment from ServiceNow to JIRA for that I have tried to send values like the below formates but nothing is working can anyone provide code or tell me what is the issue.
Sample 1 : This code is giving response 200 but no attachment added in the JIRA
// Add your code here
var JiraAttachment = new sn_ws.RESTMessageV2('Send Attachment to JIRA', 'Default GET');
JiraAttachment.setHttpMethod("post");
JiraAttachment.setBasicAuth("rrs.com", "TYSPuVMHkbws55C2");
JiraAttachment.getRequestHeader("Content-Type", " multipart/form-data");
JiraAttachment.setRequestHeader('X-Atlassian-Token', 'no-check');
JiraAttachment.setQueryParameter('table_name', 'incident');
JiraAttachment.setQueryParameter('table_sys_id', "2b95d7e32f23011009d159ab2799b6e1");
JiraAttachment.setRequestBodyFromAttachment('565b47b32f67411009d159ab2799b6d6');
var Attachmentresponse = JiraAttachment.execute();
var AttachmentBodyBody = Attachmentresponse.getBody();
var httpStatus = Attachmentresponse.getStatusCode();
var errorCode = Attachmentresponse.getErrorMessage();
gs.log('****Sendingattach ' + httpStatus + errorCode);
*** Script: ****Sendingattach 200
--------------------------------------------------------------------
Sample 2 : This code is giving response 415 but no attachment added in the JIR
var request = new sn_ws.RESTMessageV2();
request.setHttpMethod('post');
request.setRequestHeader("X-Atlassian-Token", "no-check");
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.setEndpoint('https://serctor.atlassian.net/rest/api/2/issue/SER-10/attachments');
request.setBasicAuth("rrs.com", "TYSPuVMHkbws55C2");
request.setQueryParameter('table_name', 'incident');
request.setQueryParameter('table_sys_id', "2b95d7e32f23011009d159ab2799b6e1");
request.setRequestBodyFromAttachment('565b47b32f67411009d159ab2799b6d6'); //sys_id of attachment record
var response = request.execute();
var AttachmentBodyBody = response.getBody();
var httpStatus = response.getStatusCode();
gs.log('****Sendingattach ' + AttachmentBodyBody + httpStatus )
*** Script: ****Sendingattach 415
--------------------------------------------------------------------
Sample 3 : This code is giving response 200 but no attachment added in the JIRA
var request = new sn_ws.RESTMessageV2();
request.setHttpMethod('post');
request.setRequestHeader("X-Atlassian-Token", "no-check");
request.setRequestHeader("Content-type", "multipart/form-data; boundary=AAA");
request.setEndpoint('https://servicenowdoctor.atlassian.net/rest/api/2/issue/SER-10/attachments');
request.setBasicAuth("r.ra.com", "TYSPuVM55C2");
request.setRequestBodyFromAttachment('565b47b32f67411009d159ab2799b6d6'); //sys_id of attachment record
var response = request.execute();
var AttachmentBodyBody = response.getBody();
var httpStatus = response.getStatusCode();
*** Script: ****Sendingattach 200

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2022 12:05 AM
Hello
Can you please go through below threads.
https://community.servicenow.com/community?id=community_question&sys_id=d22ec3eddb9cdbc01dcaf3231f961919
https://community.servicenow.com/community?id=community_question&sys_id=10dfdc1bdb196090b1b102d5ca961921
Regards
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2022 12:17 AM
I tried those links but its not working for me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2022 05:36 AM
Ramesh, hello. Do you use any tool for establishing the connection between the two systems? We use such and there are no issues with sending attachments whatsoever (among with the rest of the data that we transfer between the two systems).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2023 05:03 AM
@ramesh_r Did you get answer to this? Can you please share the solution here?