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
#else
<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.
Ok. I found another solution (to override method getValueFromIssue):
@Override
@Nullable
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just when I needed to do this, I found your answer ;-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I got it working! My company has permitted me to open-source my solution:
https://github.com/theschles/JIRA_ScriptRunner_AlwaysDisplaySelectList
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
And then:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But that's not what happens with system fields. All I need is to do what system fields do, but with customization.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
https://jira.atlassian.com/browse/JRA-6697
https://jira.atlassian.com/browse/JRA-2997
for this some patches are released for old versions of jjira but not for latest version, just gothrough this link it may help you
https://confluence.atlassian.com/display/JIRACOM/Displaying+Custom+Fields+with+no+value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unless it's components, or labels, or fix version, or.....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.