Need a misc calculated field that shows Components of an issue as a String

Hi All,

I've just started using EazyBI and I'm adding some extra fields to it using the MISC custom fields add-in. 

So far so good for most simple things I need, however I am now trying a more complex field to store all Components selected on an issue into a separate custom text field as a comma delimitted string.

I just can't seem to get the right syntax or I'm missing something obvious.

On the EazyBI website I can see this example for Fix Versions:

<!-- @@Formula:
import org.apache.commons.lang.StringUtils;
StringUtils.join(issue.get("fixVersions"), ",");

This works great for that field. I then tried issue.get("components") but that didn't work for me.

Looking through the API knowledge base for Components it seems I need to use issue.getComponents() to return a collection and then .getName() to return the name part of the collection? 

Anyone know a simple way to grab all the names of the selected components and put them into a string? 

Any help is much appreciated!


1 answer

1 accepted

This widget could not be displayed.
Gaston Valente Community Champion Jul 19, 2017

Hi Gareth,

I'm sure there're better and more clean ways, but this should work:

<!-- @@Formula:

import com.atlassian.jira.bc.project.component.ProjectComponent;
import java.lang.StringBuffer;

StringBuffer issueComponents = new StringBuffer();

for(ProjectComponent pc : issue.get("components")){
if(issueComponents.length() > 0) issueComponents.append(",");


Thanks this works perfectly!

Gaston Valente Community Champion Jul 23, 2017


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

536 views 3 19
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you