# Import fields in eazyBI from Checklist for Jira app

**URL:** <https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382>\
**Category:** Tips & Tricks\
**Created:** [December 2, 2021, 10:17am UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382 "2021-12-02T10:17:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![martins.vanags](https://community.eazybi.com/user_avatar/community.eazybi.com/martins.vanags/32/8905_2.png) [@martins.vanags](https://community.eazybi.com/u/martins.vanags)\
**Post date:** [December 2, 2021, 10:17am UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/1 "2021-12-02T10:17:25Z")

</div>

If you use eazyBI for Jira Data Center and wish to import custom fields provided by [Checklist](https://marketplace.atlassian.com/apps/1211562/checklist-for-jira?hosting=server&tab=overview) 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](https://docs.eazybi.com/eazybi/data-import/data-from-jira/jira-custom-fields/advanced-settings-for-custom-fields):  
_(use Jira custom field ID instead of **NNNNN** in following codes)_

```auto
#all items as comma separated string from Checklist
[jira.customfield_NNNNN]
data_type = "text"
name = "Checklist items all"

```

This field is mandatory to import the following calculated fields.  
The next code would let you import a comma-separated list of only checked items from the field:

```auto
#only checked items from the custom field - comma saprated list
[jira.customfield_chlnames]
name = "Checked item list"
data_type = "text"
javascript_code = '''
if( issue.fields.customfield_NNNNN){
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)
            }
        }
    return resultArray.join(",");
      }
}
'''

```

The first two fields when imported as **[properties](https://docs.eazybi.com/eazybi/data-import/data-from-jira#JiraIssuesImport-JiraCustomFields)** 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.

```auto
#counts only checked items and imports as measure
[jira.customfield_chlcheckedcount]
name = "Checked item count"
data_type = "integer"
measure = true
javascript_code = '''
if( issue.fields.customfield_NNNNN){
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) {return counter;}     
      }
}
'''

```

Martins / eazyBI:

 ![image](https://community.eazybi.com/uploads/default/original/2X/9/98de6d5efca54334f07298ceb61de8f8279911af.jpeg)

---

<div class="post-metadata">

**Author:** ![martins.vanags](https://community.eazybi.com/user_avatar/community.eazybi.com/martins.vanags/32/8905_2.png) [@martins.vanags](https://community.eazybi.com/u/martins.vanags)\
**Post date:** [December 2, 2021, 10:45am UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/2 "2021-12-02T10:45:02Z")

</div>

You can add one more code to advanced settings to import count total items for a checklist field

```auto
[jira.customfield_chlallitc]
name = "chl all item count"
data_type = "integer"
measure = true
javascript_code = '''
if(issue.fields.customfield_18500){
var result = 
  getDocument("/rest/api/latest/issue/" + issue.key +"?fields=customfield_18500");
var itemcounter = 0;
    if (result){
        for(x of result.fields.customfield_18500){
          if(x.name)
            {
              itemcounter++;
            }
        }
    if(itemcounter>0) {return itemcounter;}     
      }
}
'''

```

Just make sure you import the field as a **measure** from the [import options](https://docs.eazybi.com/eazybi/data-import/data-from-jira#JiraIssuesImport-JiraCustomFields) page.

Later you can create a report with a calculated measure that has cell conditional formatting and show the percentage checked vs all.  
Martins / eazyBI

 ![image](https://community.eazybi.com/uploads/default/original/2X/e/e86395f26b17c4ddcae4f4bd2b1dfe0260591746.jpeg)

---

<div class="post-metadata">

**Author:** ![teomolina](https://community.eazybi.com/letter_avatar_proxy/v4/letter/t/e68b1a/32.png) [@teomolina](https://community.eazybi.com/u/teomolina)\
**Post date:** [December 13, 2021, 10:54am UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/3 "2021-12-13T10:54:27Z")

</div>

Hi,  
Is it possible to do it as a dimension with separate values?

If we have three values First, Second, Third  
I select two values in the issue, First and Second,

As a dimension only one value is shown separated by commas (First, Second).

I need the dimension to show two values, First and Second.

Thank you.

---

<div class="post-metadata">

**Author:** ![martins.vanags](https://community.eazybi.com/user_avatar/community.eazybi.com/martins.vanags/32/8905_2.png) [@martins.vanags](https://community.eazybi.com/u/martins.vanags)\
**Post date:** [December 13, 2021, 11:41am UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/4 "2021-12-13T11:41:48Z")

</div>

@teomolina

Where do you see such a dimension with one value (by commas) in my screenshot?

There is a workaround to import the field as a multi-value dimension, but you should be careful with multi-value dimensions as issues can be double-counted.

What is the use-case? Why would need to separate values as unique dimension members? What do expect to calculate per each “True” value?

Martins / eazyBI

---

<div class="post-metadata">

**Author:** ![teomolina](https://community.eazybi.com/letter_avatar_proxy/v4/letter/t/e68b1a/32.png) [@teomolina](https://community.eazybi.com/u/teomolina)\
**Post date:** [December 13, 2021, 12:40pm UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/5 "2021-12-13T12:40:49Z")

</div>

Three values in checklist:  
A, B, C

I have three issues  
Issue 1 → Selected A,B  
Issue 2 → Selected B  
issue 3 → Selected B, C

What is currently working with Dimension, to get the issues created:  
A, B → 1 issue  
B → 1 issue  
B,C → 1 issue

What I would like too;  
A → 1 issue  
B → 3 issues  
C → 1 issue

The total number of issues (4) does not match the actual issues (3) but that does not matter.

---

<div class="post-metadata">

**Author:** ![martins.vanags](https://community.eazybi.com/user_avatar/community.eazybi.com/martins.vanags/32/8905_2.png) [@martins.vanags](https://community.eazybi.com/u/martins.vanags)\
**Post date:** [December 13, 2021, 2:59pm UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/6 "2021-12-13T14:59:41Z")

</div>

What code have you used in advanced settings to define this dimension?  
My example above doesn’t share details on how to import the checklist field as **dimension**.

Martins

---

<div class="post-metadata">

**Author:** ![teomolina](https://community.eazybi.com/letter_avatar_proxy/v4/letter/t/e68b1a/32.png) [@teomolina](https://community.eazybi.com/u/teomolina)\
**Post date:** [December 13, 2021, 5:33pm UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/7 "2021-12-13T17:33:35Z")

</div>

I used the same code, adding dimension = true.  
And with that I have the first part:  
A, B → 1 issue  
B → 1 issue  
B, C → 1 issue

I don’t know if there is any way to get also the second part.

---

<div class="post-metadata">

**Author:** ![martins.vanags](https://community.eazybi.com/user_avatar/community.eazybi.com/martins.vanags/32/8905_2.png) [@martins.vanags](https://community.eazybi.com/u/martins.vanags)\
**Post date:** [December 14, 2021, 8:13am UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/8 "2021-12-14T08:13:01Z")

</div>

You can import dimension with multiple\_values = false condition, but it would require double import if the field is already imported without this setting.

Please provide exact code you used to define dimension and I will help you modify it to import each value as separate member.

Martins / eazyBI

---

<div class="post-metadata">

**Author:** ![teomolina](https://community.eazybi.com/letter_avatar_proxy/v4/letter/t/e68b1a/32.png) [@teomolina](https://community.eazybi.com/u/teomolina)\
**Post date:** [December 14, 2021, 3:00pm UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/9 "2021-12-14T15:00:13Z")

</div>

Code I’m using

```auto
#DOR
[jira.customfield_10601]
name = "DOR"
data_type = 'string'
dimension = true

#only checked items from the custom field - comma saprated list
[jira.customfield_DORSelect]
name = "DOR Select"
data_type = "string"
dimension = true
multiple_values = false
javascript_code = '''
if (issue.fields.issuetype.name=="Story" || issue.fields.issuetype.name=="Bug" || issue.fields.issuetype.name=="Feature") {
var result = getDocument("/rest/api/latest/issue/" + issue.key +"?fields=customfield_10601");
var resultArray = [];
    if (result){
        for(x of result.fields.customfield_10601){
          if(x.checked)
            {
              resultArray.push(x.name)
            }
        }
    issue.fields.customfield_DORSelect = resultArray.join(",");
      }
}
'''

```

---

<div class="post-metadata">

**Author:** ![martins.vanags](https://community.eazybi.com/user_avatar/community.eazybi.com/martins.vanags/32/8905_2.png) [@martins.vanags](https://community.eazybi.com/u/martins.vanags)\
**Post date:** [December 15, 2021, 8:32am UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/10 "2021-12-15T08:32:36Z")

</div>

@teomolina

In this case, here is what you can try the following steps:

1. open import options and **unselect** the field “DOR Select” and import data without it. Wait while import finishes. That will drop the field from the database with your current advanced settings

2. make changes to **[advanced settings](https://docs.eazybi.com/eazybi/data-import/data-from-jira/jira-custom-fields/advanced-settings-for-custom-fields)** as follows;

```auto
#only checked items from the custom field - comma saprated list
[jira.customfield_DORSelect]
name = "DOR Select"
data_type = "string"
dimension = true
multiple_values = true
split_by = ","
javascript_code = '''
if (issue.fields.issuetype.name=="Story" || issue.fields.issuetype.name=="Bug" || issue.fields.issuetype.name=="Feature") {
var result = getDocument("/rest/api/latest/issue/" + issue.key +"?fields=customfield_10601");
var resultArray = [];
    if (result){
        for(x of result.fields.customfield_10601){
          if(x.checked)
            {
              resultArray.push(x.name)
            }
        }
    return resultArray.join(",");
      }
}
'''

```

1. open the [import options](https://docs.eazybi.com/eazybi/data-import/data-from-jira#JiraIssuesImport-JiraCustomFields) page and import “DOR Select” field as dimension.

Martins / eazyBI

---

<div class="post-metadata">

**Author:** ![teomolina](https://community.eazybi.com/letter_avatar_proxy/v4/letter/t/e68b1a/32.png) [@teomolina](https://community.eazybi.com/u/teomolina)\
**Post date:** [December 21, 2021, 11:42am UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/11 "2021-12-21T11:42:11Z")

</div>

With this code an error is displayed.  
 ![image](https://community.eazybi.com/uploads/default/original/2X/1/142d6c0e44170ae2aad2271c209296ea7859b602.png)

I have tried and it is the following line:  
multiple\_values = true

If remove that line, there is no error, but the result does not change and still show the grouped values.

---

<div class="post-metadata">

**Author:** ![martins.vanags](https://community.eazybi.com/user_avatar/community.eazybi.com/martins.vanags/32/8905_2.png) [@martins.vanags](https://community.eazybi.com/u/martins.vanags)\
**Post date:** [December 22, 2021, 10:25am UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/12 "2021-12-22T10:25:20Z")

</div>

Try adding extra validation for the Js

```auto
#only checked items from the custom field - comma saprated list
[jira.customfield_DORSelect]
name = "DOR Select"
data_type = "string"
dimension = true
multiple_values = true
split_by = ","
javascript_code = '''
if (issue.fields.issuetype.name=="Story" || issue.fields.issuetype.name=="Bug" || issue.fields.issuetype.name=="Feature") {
var result = getDocument("/rest/api/latest/issue/" + issue.key +"?fields=customfield_10601");
var resultArray = [];
    if (result){
        for(x of result.fields.customfield_10601){
          if(x.checked)
            {
              resultArray.push(x.name)
            }
        }
    if(issue.fields.customfield_10601){return resultArray.join(",");}
      }
}
'''

```

---

<div class="post-metadata">

**Author:** ![martin.chalany](https://community.eazybi.com/user_avatar/community.eazybi.com/martin.chalany/32/6270_2.png) [@martin.chalany](https://community.eazybi.com/u/martin.chalany)\
**Post date:** [January 14, 2022, 2:13pm UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/13 "2022-01-14T14:13:18Z")

</div>

Checklist addon allows users to insert heading among items. So it can be useful to filter these type of entries (via _isHeader_ parameter). E.g.

```auto
[jira.customfield_chlallitc]
name = "chl all item count"
data_type = "integer"
measure = true
javascript_code = '''
var result = 
  getDocument("/rest/api/latest/issue/" + issue.key +"?fields=customfield_18500");
var itemcounter = 0;
    if (result){
        for(x of result.fields.customfield_18500){
          if(x.name && !x.isHeader)
            {
              itemcounter++;
            }
        }
    if(itemcounter>0) {issue.fields.customfield_chlallitc = itemcounter;}     
      }
'''

```

---

<div class="post-metadata">

**Author:** ![Christopher\_Gervais](https://community.eazybi.com/user_avatar/community.eazybi.com/christopher_gervais/32/6313_2.png) [@Christopher\_Gervais](https://community.eazybi.com/u/Christopher_Gervais)\
**Post date:** [January 25, 2022, 10:07pm UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/14 "2022-01-25T22:07:51Z")

</div>

Hello! Im trying to add a checklist via the advanced Settings but I get this error :

Execution of custom JavaScript code raised the following error:  
TypeError: Cannot read property “customfield\_12001” from undefined

Here is the code :

```auto
#Acceptance Criteria
[jira.customfield_12001]
data_type = "text"
name = "Acceptance Criteria"

#only checked items from Acceptance criteria - comma saprated list
[jira.customfield_ACnames]
name = "Checked Acceptance Criteria"
data_type = "text"
javascript_code = '''
var result = 
  getDocument("/rest/api/latest/issue/" + issue.key +"?fields=customfield_12001");
var resultArray = [];
    if (result){
        for(x of result.fields.customfield_12001){
          if(x.checked)
          {
            resultArray.push(x.name)
          }
        }
        issue.fields.customfield_ACnames = resultArray.join(",");
     }
'''

```

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![martins.vanags](https://community.eazybi.com/user_avatar/community.eazybi.com/martins.vanags/32/8905_2.png) [@martins.vanags](https://community.eazybi.com/u/martins.vanags)\
**Post date:** [January 26, 2022, 7:59am UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/15 "2022-01-26T07:59:05Z")

</div>

@Christopher_Gervais

You would need one extra validation for the field 12001 for issues when this field is not entered.

Try the following in your second script:

```auto
#only checked items from Acceptance criteria - comma saprated list
[jira.customfield_ACnames]
name = "Checked Acceptance Criteria"
data_type = "text"
javascript_code = '''
if(issue.fields.customfield_12001){
var result = 
  getDocument("/rest/api/latest/issue/" + issue.key +"?fields=customfield_12001");
var resultArray = [];
    if (result){
        for(x of result.fields.customfield_12001){
          if(x.checked)
          {
            resultArray.push(x.name)
          }
        }
        if(issue.fields.customfield_12001){return resultArray.join(",");}
     }
}
'''

```

Martins / eazyBI

---

<div class="post-metadata">

**Author:** ![Christopher\_Gervais](https://community.eazybi.com/user_avatar/community.eazybi.com/christopher_gervais/32/6313_2.png) [@Christopher\_Gervais](https://community.eazybi.com/u/Christopher_Gervais)\
**Post date:** [January 26, 2022, 4:42pm UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/16 "2022-01-26T16:42:29Z")

</div>

> [@martins.vanags](#):
>
> ```auto
> [jira.customfield_ACnames]
> name = "Checked Acceptance Criteria"
> data_type = "text"
> javascript_code = '''
> var result = 
> getDocument("/rest/api/latest/issue/" + issue.key +"?fields=customfield_12001");
> var resultArray = [];
> if (result){
> for(x of result.fields.customfield_12001){
> if(x.checked)
> {
> resultArray.push(x.name)
> }
> }
> if(issue.fields.customfield_12001){issue.fields.customfield_ACnames = resultArray.join(",");}
> }
> '''
> 
> ```

Hello Martins,

I tried the script you sent me, but I still get the same error.  
I also tried the “if(issue.fields.customfield\_12001){}” condition within all the section under “if (result) {}” but still no success :-/

Thank you

---

<div class="post-metadata">

**Author:** ![martins.vanags](https://community.eazybi.com/user_avatar/community.eazybi.com/martins.vanags/32/8905_2.png) [@martins.vanags](https://community.eazybi.com/u/martins.vanags)\
**Post date:** [January 27, 2022, 8:33am UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/17 "2022-01-27T08:33:02Z")

</div>

@Christopher_Gervais

Make sure that the custom field **12001** is also selected and imported as **property**.

Martins

---

<div class="post-metadata">

**Author:** ![Christopher\_Gervais](https://community.eazybi.com/user_avatar/community.eazybi.com/christopher_gervais/32/6313_2.png) [@Christopher\_Gervais](https://community.eazybi.com/u/Christopher_Gervais)\
**Post date:** [January 27, 2022, 7:33pm UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/18 "2022-01-27T19:33:02Z")

</div>

Hello Martins,

I have checked and import as property as follow :

 ![image](https://community.eazybi.com/uploads/default/original/2X/3/36491e80cc6f7ef8369004a784e1077cce99d9c5.png)

Am I missing something?

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![martins.vanags](https://community.eazybi.com/user_avatar/community.eazybi.com/martins.vanags/32/8905_2.png) [@martins.vanags](https://community.eazybi.com/u/martins.vanags)\
**Post date:** [January 28, 2022, 8:22am UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/19 "2022-01-28T08:22:58Z")

</div>

@Christopher_Gervais

Do you see any values for issues when selecting the property “Issue Acceptance Criteria” from Measures dimension in **columns** , and “Issue” dimension members (at issue-level) in report **rows**?  
Is Acceptance criteria field correctly imported?

Martins / eazyBI

---

<div class="post-metadata">

**Author:** ![Christopher\_Gervais](https://community.eazybi.com/user_avatar/community.eazybi.com/christopher_gervais/32/6313_2.png) [@Christopher\_Gervais](https://community.eazybi.com/u/Christopher_Gervais)\
**Post date:** [January 31, 2022, 2:51pm UTC](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382/20 "2022-01-31T14:51:55Z")

</div>

Hello Martins,

I can confirm that some have a value (Issue with values in the Checklist), and other are empty (without value in the checklist)

 ![image](https://community.eazybi.com/uploads/default/original/2X/9/9e2c3cc23cdf56cadbf6e2be00ebe8751cd9d3aa.png)

Thank you 🙂

[Next page](https://community.eazybi.com/t/import-fields-in-eazybi-from-checklist-for-jira-app/8382.md?page=2)
