If you use eazyBI for Jira Server and wish to import custom fields provided by Checklist for the Jira app, you could find this thread useful.
To import all items from the checklist field, you could use this code in your advanced settings:
(use Jira custom field ID instead of NNNNN in following codes)
#all items as comma separated string from Checklist
[jira.customfield_NNNNN]
data_type = "text"
name = "Checklist items all"
The next code would let you import a comma-separated list of only checked items from the field:
#only checked items from the custom field - comma saprated list
[jira.customfield_chlnames]
name = "Checked item list"
data_type = "text"
javascript_code = '''
var result =
getDocument("/rest/api/latest/issue/" + issue.key +"?fields=customfield_NNNNN");
var resultArray = [];
if (result){
for(x of result.fields.customfield_NNNNN){
if(x.checked)
{
resultArray.push(x.name)
}
}
issue.fields.customfield_chlnames = resultArray.join(",");
}
'''
The first two fields when imported as properties would let you see the details per issue level.
The last code would create an integer number that would count the checked items in your CHecklist field. This field can be imported as measure and used in report to count checked items in other hierarchy levels or even when “Issue” dimension won’t be used in the report.
#counts only checked items and imports as measure
[jira.customfield_chlcheckedcount]
name = "Checked item count"
data_type = "integer"
measure = true
javascript_code = '''
var result =
getDocument("/rest/api/latest/issue/" + issue.key +"?fields=customfield_NNNNN");
var counter = 0;
if (result){
for(x of result.fields.customfield_NNNNN){
if(x.checked)
{
counter++;
}
}
if(counter>0) {issue.fields.customfield_chlcheckedcount = counter;}
}
'''
Martins / eazyBI:
2 posts - 1 participant