All eazyBI for Jira eazyBI for Confluence Private eazyBI

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 fields are defined in Source Data → Import options.

Internal name

cf_alllinks

Display nameCount of all links
Data type

integer 

Measures

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 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 codeKeep 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
'''