Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I get all custom field values using JIRA API

Svante Gustafsson Björkegren
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.
February 21, 2013

I am customizing the velocity template for Release Notes and have added e.g. assignee and release notes fields to it. That was quite forward and well documented.

But now I need to re-structure the report as well. The structure on the out-of-the box report is grouped per Issue type, but I need to have them grouped per Development Team (which is a custom field in our instance).

To do this I need to have all possible values for this field and loop over them one by one and print out the issues when they match with the current Dev Team. Pretty much in the same way as the out-of-the box report does with Issue Types.

I haven't found out though have to get all possible values of a custom field into the variable $options to be able to do that loop.

Any hints?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Henning Tietgens
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.
February 21, 2013

I'm not sure if you can access all the needed managers from the release notes velocity template, but if, then you can get the fieldConfig from the customfield and an issue and use this to get the options from the optionsManager.

In Groovy it looks like this.

fieldConfig = cfTheCustomField.getRelevantConfig(issue)
options = optionsManager.getOptions(fieldConfig)

I hope this helps.

Henning

Svante Gustafsson Björkegren
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.
February 26, 2013

Hi,

I have been trying to use the OptionsManager in the velocity template but we no success. Do you know any easy way to debug these templates? As I am doing it now I update the template and the I have to re-start JIRA to see the result. This feed-back loop is way to long to be efficient.

Do you have any ideas!

Rgrds,

// Svante

Henning Tietgens
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.
February 26, 2013

Look at "Deploying Velocity templates without restarting JIRA" on https://confluence.atlassian.com/display/JIRA/Customising+Email+Content for a faster way to test changes.

Henning Tietgens
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.
February 26, 2013

I think this is a blind alley... I looked into the source of the ReleaseNoteManager and you only have these bindings within the releasenotes velocity template:

  • action
  • req (ExecutingHttpRequest.get())
  • issueTypes
  • appProps (applicationProperties)
  • version
  • versionObj
  • project (project.getString("name"))
  • textUtils
  • requestContext
  • constantsManager
  • customFieldManager

Svante Gustafsson Björkegren
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.
February 26, 2013

Great! Thnx for the tip with the updating velocity templates without JIRA re-start! That will become handy for sure anyway!

I will look into the JIRA Xporter plugin instead for generating the report instead.

TAGS
AUG Leaders

Atlassian Community Events