jira custom field plugin - field value not showing on view screen

gil June 23, 2012

So I created a custom field plugin for JIRA. Everything is working fine except that the $value in the volocity template for 'view' screen is not shown on the view ticket screen.

I implemented this override function:

public Map getVelocityParameters(Issue issue, CustomField field, FieldLayoutItem fieldLayoutItem)

and return a value at end of the function, i.e.:

params.put("calculatedValue", calculatedValue);

return params;

4 answers

0 votes
Lance Wong May 27, 2013

im experiencing the same problem. I have been working nicely with some other custom fields that are only used on edit screens. For the first CF used on a view screen, i cannot get it to be displayed. The CFs configuration scheme is "global - all issues". Here is my override method(started from the SDK template)

public Map<String, Object> getVelocityParameters(final Issue issue,
                                                     final CustomField field,
                                                     final FieldLayoutItem fieldLayoutItem) {
log.info("Entered getVelocityParametersVIEW");
        final Map<String, Object> map = super.getVelocityParameters(issue, field, fieldLayoutItem);

        // This method is also called to get the default value, in
        // which case issue is null so we can't use it to add currencyLocale
        if (issue == null) {
        	map.put("item", "nothing");
            return map;
        }

         FieldConfig fieldConfig = field.getRelevantConfig(issue);
         //add what you need to the map here
         	map.put("item", "something");
        return map;
}

when editing the default value, $item is "something" (which also puzzles me, but anyways)

when viewing the configuration info, $item is not set (displays as "$item")

when viewing an issue that has this CF on its view screen, the CF isnt displayed. Also cant find the customfield_# in the HTML source. This tells me that JIRA thinks that this field has no value, which coincides with what i described above. So i must be setting the value of this field incorrectly?

Change in direction : I just created a new issue after installing my said custom field and it displayed on the view screen. So this makes sense to me having worked with issues and other custom fields. So now my question is, for my plugin-custom-field, how do i get "all" issues to display it? and not just issues created after the installation of my plugin-custom-field? I guess i could set a value for all issues, but that sounds so inelegant...

0 votes
Higashi
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.
September 13, 2012

Have you added field to screen, have permission to view it ? :)

0 votes
Mikkel Kragelund Nielsen
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.
June 27, 2012

Just to be sure:

You have added the field, to the view?

0 votes
Dieter
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.
June 23, 2012
If you set calculatedValue in the map you should also use $calculatedValue instead of $value in the velocity template
gil June 23, 2012

did that, but this value only shows on the column view (issue navigator), the value won't show in the ticket view screen.

Dieter
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.
September 14, 2012
Do you have two velocity templates, one for view and one for column-view ?

Suggest an answer

Log in or Sign up to answer