The CreatorCon Call for Content is officially open! Get started here.

Send attachment from Servicenow to JIRA using REST API

kumaran
Giga Expert

I am working in ServiceNow to JIRA integration using REST API, I have implemented all the fields to create JIRA issue.

I am currently trying to send attachment from ServiceNow to JIRA ticket using mid server.

I used the below code as example in the post Jira REST Integration - How to send attachment? :

var request = new sn_ws.RESTMessageV2();

              request.setHttpMethod('post');

              request.setRequestHeader("X-Atlassian-Token","no-check");

                request.setRequestHeader("Content-type","multipart/form-data");

              request.setEndpoint('https://{jiraURL}/rest/api/2/issue/SN-2/attachments');

              request.setBasicAuth("username","password");

              request.setRequestBodyFromAttachment('abd7460b0fe39e001dc906ace1050e9f'); //sys_id of attachment record

            var response = request.execute();

I am getting error in ECC Queue as 'attachment does not exists'

If anyone implemented this , please let me know .

Thanks in Advance.

31 REPLIES 31

srisri
Giga Contributor
@uluerje 

 Yes please share me the code..

We are using webhook.. Scripted rest api from jira to Snow field mapping.

 

Please help

Regards

Sri

Hello,

We are working on ServiceNow <> JIRA Integration and we have a requirement to send the attachment by using MID Server script include.

 

Can you assist by sharing the code. You can connect on attarkhozema@gmail.com

 

Regards,

Khozema

willmorisseau
Kilo Explorer

Hello All,



Sounds like everyone is having some trouble with the attachments. I found that it takes 8 different web service calls to move one record with an attachment from SNOW to Jira.



The native Perspectium app in the SNOW platform solves this issue, synchronizing data in real time between instances and Jira - all natively with no coding / web servicees. if anyone would like more information please feel free to contact me directly william.morisseau@perspectium.com


John VanBruggen
Giga Guru

I am not familiar with Jira's web service calls, but with others that I have worked with, I have found that to send a file to another system, it needs to first be converted to Base 64.  
Here is some info from the guru that might be able to help with that.
I used this to send a file from SNow to Workday.
Sending attachments to a 3rd-party service desk - ServiceNow Guru


Check out my Consultant's Survival Guide
https://youtube.com/watch?v=zYi8KhP9SUk

dmarzovilla
Kilo Contributor

Hi Kumaran,



You might want to look at the platform DragonGlass.   It has connectors to both servicenow and jira, and utilizes REST APIs in order to aid its search capabilities. It extracts data and you can also search and create analytics across data stores.   Hope this helps.



Thanks,



Domenico