How to get unused the options of custom field

Hi All,

I want to find which options of one custom field are not used by issues , and i get one function is like "issue Object getCustomFieldValue(CustomField customField)", Do we have any other way to fetch the unused options besides to search in all issues ?

1 answer

1 accepted

1 vote
Dieter Community Champion May 03, 2012
You would have to loop through the options and for each option you can get the list of issues having this option value using this method,%20com.atlassian.jira.issue.customfields.option.Option)

This could be faster than looping through the issues and calling getCustomFieldValue if you don't have so many options but a large number of issues

Dieter Community Champion May 03, 2012
The method is defined in interface

Please check the link which custom field types implement it

thanks for your information .

Hi Dieter, I'm wondering how to create a MultipleSettableCustomFieldType Object to call the mothod "getIssueIdsWithValue", when i use

MultipleSettableCustomFieldType mc = (MultipleSettableCustomFieldType)ComponentManager.getComponentInstanceOfType(MultipleSettableCustomFieldType.class);

for(Option op : opt)
  if (mc.getIssueIdsWithValue(cf,op).isEmpty())

"mc.getIssueIdsWithValue(cf,op).isEmpty() " will cause a java.lang.NullPointerException. Thanks .

I've found the solution like this :

CustomField cf = getCustomField();

CustomFieldType cft = cf.getCustomFieldType();

final MultipleSettableCustomFieldType mc = (MultipleSettableCustomFieldType) cft;

anyway .thanks very much .

Suggest an answer

Log in or Join to answer
Community showcase
Jason Wong
Published yesterday in Agility Beta

Welcome to agility

Every team in the world is unique, and so   Atlassian believes   that each and every team's best way of working  needs to  be molded to their unique circumstances  – ...

324 views 6 15
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot