Count of all links
eazyBI for Jira
Calculated field to retrieve count of all linked tickets except the epic link and parent link (for sub-task). You can import this field as a measure for each ticket.
Account-specific calculated field
Account specific calculated fields are defined in Source Data → Import options.
Settings for the new field
| Internal name | cf_alllinks |
|---|---|
| Display name | Count of all links |
| Data type | integer |
| Measures | ✓ |
Custom JavaScript code:
var issuelinks = new Array();
var counter = null;
if ( issue.fields.issuelinks ) {
var links = issue.fields.issuelinks;
for (var i = 0; i < links.length; i++) {
var link = links[i];
//count outward links that are not to epics or sub-taks
if (link.outwardIssue) {
if( link.type.outward != "is Epic of" && link.type.outward != "jira_subtask_outward") {
issuelinks.push(link.outwardIssue.key);
counter = counter+1;
}
}
else
//count inward links that are not to epics or sub-taks
if( link.type.inward != "has Epic" && link.type.inward != "jira_subtask_inward") {
issuelinks.push(link.inwardIssue.key);
counter = counter+1;
}
}
return counter;
}
Global calculated field
Global calculated fields are defined in eazyBI advanced settings.
Here are the settings for the new field definitions. You should insert the JavaScript (the code given above) below the line // Insert here the Custom JavaScript code. Keep the opening and closing quotation marks. ''', do not delete them.
# Counter of all links as measure [jira.customfield_count_links] name = "Count all links" data_type = "integer" measure = true javascript_code = ''' // Insert here the Custom JavaScript code '''