How to get default values for custom fields.

Rupali Petkar October 23, 2011

I have one cutom field C1. This C1 type is radiobutton selection . In this C1 field i set values "high", "low", "Medium".

Now i want to get these all values of C1 in my custom JIRA application irrespective of issue.

4 answers

1 vote
Rupali Petkar October 23, 2011

My code is not aware of all possible values . And my code want to get list of all possible values. This is my query

0 votes
Jobin Kuruvilla [Adaptavist]
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.
October 24, 2011

If you are trying to get the available options, you can get it using OptionsManager. Note that the options can change based on the field configuration and hence you need the field config first.

Options options = optionsManager.getOptions(fieldConfig);

For an issue, you can get fieldConfig as follows:

FieldConfig fieldConfig = customField.getRelevantConfig(issue);

Rupali Petkar October 24, 2011

I am using http://jira.atlassian.com/rpc/soap/jirasoapservice-v2?wsdl webservice url.

To use following code which refrence i need to add . because when i use the following code i get error Opetions anf FiledConfig class are not define. Can you please explain following code in brief

Options options = optionsManager.getOptions(fieldConfig);

For an issue, you can get fieldConfig as follows:

FieldConfig fieldConfig = customField.getRelevantConfig(issue);

Nic Brough -Adaptavist-
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.
October 24, 2011

You did not bother to tell us you were trying to use the SOAP API, so Jobin assumed you were talking about a plugin or core code that has full access to the internal API. His first line of code will get you the options for a field, from the field config, and the second tells you how to establish a fieldconfig from an issue. How you get the right field config depends on where your code is running.

Last time I wrote for SOAP, there was no way to get a list of field options directly. That may have changed, see http://docs.atlassian.com/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/JiraSoapService.html for the latest version.

Jobin Kuruvilla [Adaptavist]
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.
October 24, 2011

Nic said it :)

0 votes
Rupali Petkar October 23, 2011

My code is not aware of all possible values . And my code want to get list of all possible values. This is my query

0 votes
Nic Brough -Adaptavist-
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.
October 23, 2011

Could you explain a little more? I understand that you've got a radiobutton field which has three possible values, but I'm not sure what you want to do with the value? "I want to get all values" is not clear to me - do you mean you want your code to be aware of all possible values? And is the mention of "default" in the title relevant? i.e, if your code wants the list of possible values, then it also needs to know which is the default? Or is my guesswork completely wrong?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events