I use an ETL tool to extract jira data and have a new requirement to extract linked issues
Using the following code, I get nulls and empty strings.
//flds is output from a GET API call
var _issuelinks = extractIssuelinks(flds.issuelinks.issues)
// I have also tried var _issuelinks = extractIssuelinks(flds.issuelinks-issues)
// following a scriptrunner article referencing issuelinks-issues
// the article is https://scriptrunner.adaptavist.com/5.6.8/jira/recipes/behaviours/working-with-issuelinks.html#_reading_the_value
var checkForValueInIssueLinks = function (_issuelinks, _valueToCheck) {
var retval = "N";
if (_issuelinks != null && _issuelinks.length > 0) {
var issueLen = _issuelinks.length;
for (var i = 0; i < issueLen; i++) {
var buffer = _issuelinks[i] != null && trim(_issuelinks[i]).length > 0 ? trim(_issuelinks[i]) : "";
if (upper(trim(_valueToCheck)).equals(upper(buffer))) {
retval = "Y";
}
}
}
return retval;
}
I am a bit confused on what you are doing here - how are you trying to read the data from Jira? You've mentioned up to three different possibilities in the question, and I'm not sure what you are actually doing.
I grab Jira data in a number of ways:
So, if I had to place a bet on this, my stake would go on option 2.
Is that what you are doing?
My recommendation would be to move to option 3, the REST API can tell you about links directly in a simple JSON format (far easier to process than the pile of html you get from option 2)
Sorry for the confusion.
I AM extracting data from Jira (server) via REST.
My question is how to access the result containing the issuelinks.
This is the code I am using but the results are nulll values. I am using similar code to extract components and labels successfully. However, issuelinks is not working. Hope this helps.
The expected results are the JIRA keys that populate that field.
var extractIssueLinks = function (_issueLinks) {
var retval = "";
if (_issueLinks != null && _issueLinks.length > 0) {
retval = _issueLinks.join(",");
}
return retval.length <= 256 ? retval : substr(retval,0,256);
}
var _issueLinks = extractIssueLinks(flds.issue.issuelinks);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.