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

This widget could not be displayed.
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

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 Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

191 views 18 7
Join discussion

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