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!
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(",");
issueComponents.append(pc.getName());
}
issueComponents.toString();
-->
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
great!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.