- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2017 04:00 AM
Hi All,
Hope you all doing good. Here is my another query,
Am not sure this is the right place to ask, but I hope if anyone can share your ideas that may divert me to the right direction.
I have referred this http://www.john-james-andersen.com/blog/service-now/rest-based-servicenow-jira-integration-poc.html and successfully integrated SNOW with JIRA.
But now I need to get the list of issues that are available in JIRA. Issues associated with a Project. I'm using MID server in my integration.
Since my GET parameter is different from (Jira Issue Search), I have created a new REST message. But it returns 'undefined' for total.
Below is my function,
getTaskDetails: function(){
var r = new RESTMessage('Jira Issue - Record Search', 'get');
r.setBasicAuth(gs.getProperty('com.snc.integration.jira.jira_api_user'), gs.getProperty('com.snc.integration.jira.jira_api_password'));
r.setStringParameter('base_url', gs.getProperty('com.snc.integration.jira.base_jira_instance_url'));
r.setXMLParameter('jqlstring', 'project=QA'); //For newer versions of an instance
r.setStringParameter('fields', 'id,key,summary,issuetype,priority,status');
if(this.midServer){
r.setMIDServer(this.midServer);
}
var response = this._executeRest(r);
var parser = new JSONParser();
var obj = parser.parse(response);
gs.log('obj.total............'+obj.total);
for (var t=0 ; t<obj.total; t++){
gs.log('tasks.key............'+obj.issues[t].key);
gs.log('tasks.self............'+obj.issues[t].self);
}
},
The Jira url,user name & password is working fine with the default REST messages. But here, obj.total returns 'undefined'.
Please help.
Thanks
Prici
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2017 03:55 AM
Hi Ankur Bawiska,
Yes, actually it was a kind of authentication Issue. The REST Message was having some issues on the Script Include.
Made few changes on the REST Message & I'm able make API call from Fix Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2017 04:17 AM
Hi Prici,
Did you add the rest message response to system logs and check what response you are getting from JIRA.
the value is coming as undefined may be because the response is not proper.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2017 04:48 AM
The response is just Object ([Object Object]). That is the reason i tried to get the total.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2017 05:05 AM
Hi Prici,
print the json object in logs using JSON.stringify(); and check
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2017 02:48 AM
Hi Ankur Bawiskar,
I tried the same scripts from 'Fix script' & it is working fine.
I guess some thing went wrong when I tried the script form JiraIntegration script include. It is similar to making API calls to other applications.
Thanks
Prici
