How to make customField NOT hidden when there is NO value ?

I followed this tutorial and everything is fine.

Only one thing: I would like to have my customField to NOT become hidden when there is NO value.

I tried to work with view.vm:

#if ($value)

// shows the link


<label>Hello the value is Empty!</label>

But nothing shows up. CustomField is still hidden.

Can you please give me some tips about where should I handle this?

I'm working with JIRA 5.1.8

Thanks in advance.

7 answers

1 accepted

3 votes
Accepted answer

Ok. I found another solution (to override method getValueFromIssue):



public String getValueFromIssue(CustomField field, Issue issue) {

// TODO Auto-generated method stub

String value = super.getValueFromIssue(field, issue);

return (value == null) ? "" : value ;


just pass whatever value you need and customfield always shows

Just when I needed to do this, I found your answer ;-)

2 votes

Joe has pretty much said a lot of what I would already, so I won't repeat it.

I think you'll need to change code in the core of Jira. The reason is that the framework that draws the screen is making the decision whether or not to render the field, way before you look at the templates. I imagine an internal dialogue like

  • Jira: Oi, field on issue, you got data?
  • Field on issue: Yes
  • Jira: Ok, field definition, how do I draw this?
  • Field definition: here's some velocity and some data, and my display name
  • Jira: There you are user, some nice html with a field name, and some pretty data

And then:

  • Jira: Oi, field on issue, you got data?
  • Field on issue: No
  • Jira: Ok, next field...

That's better than I could explain it :)

Since we're talking about a "custom" custom field, we do have control over "Field on issue: Yes/No" using that getValueFromIssue(..) method in the CFType class by returning a null value for "No" and non-null for "Yes".

But that's not what happens with system fields. All I need is to do what system fields do, but with customization.

I got it working!  My company has permitted me to open-source my solution:

1 vote
Joseph Pitt Community Champion Jul 25, 2013

If it has a default value and still hidden there is another problem. Make sure it is in the on the screen (at least view) and is defined to be available for the issue type/project

actually I've already checked and it's not on the view-issue-screen html page. as soon as there is no value the <div> for custom field disappears.

but it is assigned to Default Screen and it show up in Edit and Create Issue (and after adding the value)

0 votes
Joseph Pitt Community Champion Jul 25, 2013

JIRA is setup to not display most fields that don't have values. Your code may never get executed if there isn't a value

is there any way to handle it with javaScript or some other way?

I actualy tried to set e default value, but the field is still hidden.

Unless it's components, or labels, or fix version, or.....

You can control this from the your CFType class. If the getValueFromIssue method returns null, the velocity file will never get called. You can return an empty string or something to make it look like it has a value and then handle it in the velocity file.

Thanks for advice it actually almost solved everythig, there's just one new problem:

i check the value in getVelocityParameters next way :

if (getValueFromIssue(field,issue)==null)


log.warn("Field was empty");

//createValue(field, issue, "Edit");

updateValue(field, issue, "Edit");


in both cases (create and update value) the field becomes only visible after the second visit of the view issue page if the issue at first didn't have customField.

do you have any idea how to handle this ?

i think as you know, as of now it is not possible to show if the custom fields are empty, fotr this already issue openned with atlassian vote up here

for this some patches are released for old versions of jjira but not for latest version, just gothrough this link it may help you

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Jira

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,087 views 0 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you