how to get the option count for a select list in jira 4.4.5

srikanth Asoori maringanti December 18, 2012

how to get the option count for a select list in jira 4.4.5

6 answers

1 accepted

0 votes
Answer accepted
Janet Albion
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 18, 2012

Hi srinath,

I don't really understand the requirement. Just guessing the requirement here.

the following might help you in a way:

1. identify the custom field id:

select * from customfield where customfieldtypekey='com.atlassian.jira.plugin.system.customfieldtypes:select';

2. check how many option in the customfield has and what is the option id:

select * from customfieldoption where customfield=<customfield_id>;

3. find how many time the option is selected

select  count(*) from customfieldvalue where customfield=<customfield_id> and stringvalue=<option_id>;

4. list down all the value and it's corresponding issues that has the value selected:

select * from customfieldvalue where customfield=<customfield_id>;

Generally, 3 main table is related:

* customfield, customfieldoption and customfieldvalue table

Good luck



srikanth Asoori maringanti December 18, 2012

Thanks all,

My requirment is when configuring the default value for my custom field ,my custom field must select one of the statuses as default value.It worked fine in jira 4.1.2. But when I tried the same in 4.4.5. it is unable to set the default value eventhough my select list is populated with the statuses.

So I am trying to modify the code and Iam first populating the options and from the options I am trying to get the default value.

Is there any alternative way ,so that I can populate the Default value from the select list which contains all the statuses.

Thanks in advance.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 19, 2012
0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 19, 2012
0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 18, 2012

I'm sorry, that doesn't make a lot of sense. The best I can make out is that you want to "take a copy of a list of status and put it into a select list, using the status names as the option names?" After that, I'm lost. I'm also curious as to the business reason for doing this (I can think of one, but it's not a lot of use, and the best answer is actually "talk to the users")

Could you explain what you want the user to see and do?

0 votes
srikanth Asoori maringanti December 18, 2012

I want to add all the statuses to options programatically. For that i am using getAllStatuses().And also only I want the statuses to be act as options and user cannot be able to add the option directly unless it is added as status. For that I want to compare the number of options and no of statuses every time if they are diffrent then I need to erase all the options I want to populate my statuses.

If there is any alternate way please suggest me.

Thanks in advance.

0 votes
Bhushan Nagaraj
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 18, 2012

What exactly are you trying to do?

Suggest an answer

Log in or Sign up to answer