Service-Now Jira Rest Integration

garyopela
ServiceNow Employee
ServiceNow Employee

Much thanks to John Andersen, as always, for his stellar work on the Service-Now platform with regards to integrations.

ServiceNow integration to JIRA through REST API's-John James Andersen

 

I was wondering if anyone had any tips on this. I set this up and for some reason my service-now instance isn't able to communicate with the Jira instance. I can see in my logs whenever SN tries to send the data to jira to open a bug, I get the following returned: "Jira issue created: undefined"

 

Do I need to set up anything on the Jira side?

 

I have verified the "Jira base instance URL", the "Jira Project Key", as well as the "Custom ID for Service Now". Also I am having to use a mid-server, and I have verified it is up and running.

 

Any help would be greatly appreciated, as I have a lot more work to do on expanding this integration beyond just incident, but first I just have to get incident working.

 

Thanks!

1 ACCEPTED SOLUTION

pavel_muller
Giga Contributor

I've done a large JIRA integration based on the Andersen's code too. But I improved quite a lot there including the webhooks (used for updates from JIRA to SNC).



To debug your problems, the best way is to watch the ECC queue responses. There you can see the full JIRA response including the error messages and JSON. The Andersen's code is not very robust in terms of error handling. You will have to improve it before going into production.


View solution in original post

83 REPLIES 83

If you need anything else just write me. solid-serVision is pretty strong in ServiceNow integrations. We've done quite a lot of stuff recently including a complex JIRA integration.


THanks! I see in the ECC Queue i'm getting error that my custome field on the jira side is not a positive number (they gave it a text name). But i'm looking at the payload and it is trying to send "customfield_XXXX", so my question is, on the Jira side, did you prefix the name of the field with customfield_12345 or whatever, assuming 12345 was the number you used?


You always have to go to JIRA API reference docs. To set a custom field you set a property customfield_12345 with some value. I recommend to make the number configurable in properties since the number is some JIRA ID and may be different between you test and live JIRA instances.



See: JIRA REST API Example - Create Issue - JIRA Development - Atlassian Developer Documentation


Hi Gary,



I see in of the posts that you've had the need to dynamically change the property in Jira settings page such that diff apps in SNOW needs to create a diff issue in diff projects in JIRA , could you explain the basic approach taken achieving this ??



Thanks!!


yeah, it's actually pretty easy to do. If you look at Mr. Andersen's solution, it relies on a system property to pull in the project id. I simply added logic to pass a variable instead of grabbing the system property, then dynamically set that variable based on the Category/Subcategory of the incident, I think is what I used.



You could really set it from any way you needed, just instead of pulling the project id from the system property, you pull it from somewhere else.



The one caveat is that you need to pay attention to the mappings, because if the other projects in jura have different fields, then your integration won't know what to do. So, yeah, you can dynamically set the project just fine, however you have to ensure that you account for that when you are building all of your field mappings.