# Cant Select the Components even after adding Custom JavaScript code

**URL:** <https://community.eazybi.com/t/cant-select-the-components-even-after-adding-custom-javascript-code/2279>\
**Category:** Questions & Answers\
**Tags:** javascript\
**Created:** [May 30, 2019, 8:50pm UTC](https://community.eazybi.com/t/cant-select-the-components-even-after-adding-custom-javascript-code/2279 "2019-05-30T20:50:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hugues](https://community.eazybi.com/letter_avatar_proxy/v4/letter/h/f04885/32.png) [@Hugues](https://community.eazybi.com/u/Hugues)\
**Post date:** [May 30, 2019, 8:50pm UTC](https://community.eazybi.com/t/cant-select-the-components-even-after-adding-custom-javascript-code/2279/1 "2019-05-30T20:50:04Z")

</div>

Good Afternoon,  
I’m trying to Import Component/s as a Dimension because we need to be able to target Vulnerabilities by asset (Components).  
But when I add custom JavaScript code in the Additional Options and I test the custom JavaScript code with an issue test and the Information appears.

But when I go back to the custom Field tab, i Still cant select it ??

[“MyJira”.customfield\_components]  
name = “Components”  
data\_type = “string”  
dimension = true  
multiple\_values = true  
split\_by = “,”  
javascript\_code = “”

var components=issue.fields.components;  
var result=[];

if (components) {  
for (var i=0;i\<components.length;i++)

{ result.push(components[i].name); }  
issue.fields.customfield\_components=result.join(",");  
}  
“”

What am I Missing here ?!?

h

---

<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:** [June 13, 2019, 1:01pm UTC](https://community.eazybi.com/t/cant-select-the-components-even-after-adding-custom-javascript-code/2279/2 "2019-06-13T13:01:48Z")

</div>

Hi,

Quite recently we added a [page dimension](https://docs.eazybi.com/eazybi/analyze-and-visualize/create-reports#Createreports-Pagedimensions) feature where you can use the same dimension in pages and in columns/rows  
Perhaps, you can play around with “ **Project** ” dimension in your report where Component is one of the hierarchy levels in that dimension.

If you still need a separate dimension for **Components** , try this Javascript code in your eazyBI **advanced settings**.  
And you don’t need to add custom code in Additional Options but in **Advanced** settings which is a different place in UI.

Note that only Jira system administrators or eazyBI admins can access advanced settings.

Try this code to define a new dimension for Components

```auto
    [jira.customfield_eazybicomponent]
    name = "Component"
    data_type = "string"
    multiple_values = true
    split_by = ","
    dimension = true
    javascript_code = '''
    issue.fields.customfield_eazybicomponent = issue.fields.components;
    '''

```

After that, open eazyBI import options and find your new custom field “Components” under the custom\_fields tab and select it to import as a separate dimension.

Martins / eazyBI support

---

<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:** [March 13, 2020, 10:31am UTC](https://community.eazybi.com/t/cant-select-the-components-even-after-adding-custom-javascript-code/2279/3 "2020-03-13T10:31:07Z")

</div>

Hi,

The very first row of your defintion seems to be wrong.  
`["MyJira".customfield_components]`  
It should be as in my example.

Try the code I shared in my previuos answer.  
Martins / eazyBI support

---

<div class="post-metadata">

**Author:** ![ABClark](https://community.eazybi.com/letter_avatar_proxy/v4/letter/a/eb9ed0/32.png) [@ABClark](https://community.eazybi.com/u/ABClark)\
**Post date:** [December 20, 2021, 3:10pm UTC](https://community.eazybi.com/t/cant-select-the-components-even-after-adding-custom-javascript-code/2279/4 "2021-12-20T15:10:19Z")

</div>

Thank you, @martins.vanags, for that code snippet. I tried to use it and all of my issues showed “(none)” in the new dimension even though they have components.

When I look at [Issue].CurrentHierarchyMember.AllProperties - I only see “Component IDs”:  
 ![component](https://community.eazybi.com/uploads/default/original/2X/3/3de758116ad3db512e98494ddfc1eb6020286e4c.png)

My goal was to be able to combine “duplicate” components from different projects - but the text of the components isn’t available as far as I can tell.

Am I missing something? It looks like each ID would need to be mapped to text. Please advise.

Thank you…and happy holidays!

---

<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:29am UTC](https://community.eazybi.com/t/cant-select-the-components-even-after-adding-custom-javascript-code/2279/5 "2021-12-22T10:29:00Z")

</div>

Hey @ABClark ,

Have you tried selecting the property measure “Issue components”?  
There should be already a predefined measure in the “Measrues” dimension that would return all components for each issue.

Martins / eazyBI

 ![image](https://community.eazybi.com/uploads/default/original/2X/1/179d4947a4c30eaa9b2ce0f1ae134fa86570dcc8.jpeg)

---

<div class="post-metadata">

**Author:** ![ABClark](https://community.eazybi.com/letter_avatar_proxy/v4/letter/a/eb9ed0/32.png) [@ABClark](https://community.eazybi.com/u/ABClark)\
**Post date:** [December 22, 2021, 2:41pm UTC](https://community.eazybi.com/t/cant-select-the-components-even-after-adding-custom-javascript-code/2279/6 "2021-12-22T14:41:08Z")

</div>

Hi, @martins.vanags, thank you for your reply.

I did not make my need clear, my apologies. I actually found the answer I sought here: [Grouping of components from multi projects - #2 by ilze.leite](https://community.eazybi.com/t/grouping-of-components-from-multi-projects/1707/2)

I needed to filter through long lists of components from multiple projects to cull out all but a few. @ilze.leite’s solution worked like a dream for me. My gratitude to both of you!

I wish you a wonderful holiday with your families and friends! Thank you for all you do to make my job so much easier!
