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
Accepted answer
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
Community showcase
Posted yesterday in Agile

What is Scrum? A good, bad, and ugly answer.

In a world of dark-scrum, faux-scrum, and scrum-butt, the question still remains: What is scrum and how do you do it “right?” That’s the question we set out to answer. I'm Max, I've been teaching c...

79 views 0 4
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