Counting number of attachments on issues

eazyBI does not support attachment import by default. However, you can import information about attachments (count) using some options eazyBI provides.

There are two different ways if you are on Cloud or Server.

eazyBI or Jira Cloud
You can use calculated JavaScript custom field for importing count of attachments or flag if an issue has or does not have attachments.

[jira.customfield_attachment]
name = "Attachments"
data_type = "integer"
json_fields = ["attachment"]
measure = true
javascript_code = '''
if(issue.fields.attachment && issue.fields.attachment.length >0) {
  issue.fields.customfield_attachment = issue.fields.attachment.length;
}
'''

With more advanced Javascript you can access some other data of attachments as well.

eazyBI for Server
You can’t access attachments via JavaScript code. You would like to use additional data import, for example, with SQL to import attachments.

Here is an example SQL for accessing attachments from Jira database:

select issueid, created, 1 as count from fileattachment

You can use a mapping to issue dimension for issueid column with ID column, and skip missing. You can map created date of attachment to Time dimension and import count as a measure.

This measure will work by default with Issue dimension, Time dimension, and some single level custom field dimensions. It will require some calculations for more complex reports.

Daina / support@eazybi.com

1 Like