how to get custom field option using jira-rest-java-client

Vio ao December 23, 2013

how can I get custom field option using jira-rest-java-client

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Aleksander Mierzwicki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 1, 2014

You can only get it through create meta. The /rest/api/2/issue/createmeta is not supported for now

final Iterable<CimProject> metadataProjects = issueClient.getCreateIssueMetadata(new GetCreateIssueMetadataOptionsBuilder().withExpandedIssueTypesFields().build()).claim()
// Now find your project -> issue type -> get allowed values from field info - I won't write a code as this would be long booring code ;) - just follow the path:
// CimProject#getIssueTypes -> CimIssueType#getFields().get("your_field_id") -> CimFieldInfo#getAllowedValues()
// getAllowedValues() will give you Iterable<Object>, so you need to cast the result to CustomFieldOption

A bit long and verbose example that handles all supported custom field types can be found here:

https://bitbucket.org/atlassian/jira-rest-java-client/src/bd758b52f53978033bdd0d8071edd75d7bdcc607/test/src/test/java/it/AsynchronousIssueRestClientCreateIssueTest.java#cl-795

1 vote
Vio ao December 25, 2013

is there any method I can use?

0 votes
Bharadwaj Jannu
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 23, 2013
Vio ao December 23, 2013

Using rest-client not rest api!

TAGS
AUG Leaders

Atlassian Community Events