Custom field doesnt working for new Issue Type

Hi Everyone,

I have created new custom field plugin extending SelectCFType.
Custom field works properly for predefined Issue Types (example : Bug,Task,Test etc)
but when i create a new issue type and add my new custom field to that issue type.
My options doesnt load and it renders no options.

When i check the log file i see this exception below;

/secure/admin/ConfigureCustomField!default.jspa [webwork.util.ValueStack] METHOD: "viewHtml", exception:
java.lang.NullPointerException

com.atlassian.jira.issue.customfields.CustomFieldUtils.buildParams(CustomFieldUtils.java:446)

com.atlassian.jira.plugin.customfield.CustomFieldTypeModuleDescriptorImpl.getViewHtmlByValue(CustomFieldTypeModuleDescriptorImpl.java:181)

com.atlassian.jira.plugin.customfield.CustomFieldTypeModuleDescriptorImpl.getDefaultViewHtml(CustomFieldTypeModuleDescriptorImpl.java:174)

com.atlassian.jira.issue.customfields.config.item.DefaultValueConfigItem.getViewHtml(DefaultValueConfigItem.java:29)

com.atlassian.jira.issue.fields.config.FieldConfigItemImpl.getViewHtml(FieldConfigItemImpl.java:29)


What is the reason for this NullPointerException ? Have anyone help me ?

Thanks

4 answers

Hi Batuham,

Good idea to check the log files. Did you configure the plugin's velocity view template in the atlassian-plugin.xml? Can you verify atlassian-plugin.xm making sure there are no typos and that the templates exsist where the resource says they are located? Another thing it could be is that your template is asking for data that is not available to is from the getVelocityParameters method call. Check to make sure what Velocity is asking for is available in that data structure.


Good luck

Thank Thomas,

velocity file is located properly because while addind custom field, if i select "any issue type" there is no problem.

I tried, i selected "any issue type" and added new custom field then i modified its configurations to any other issue type there is no problem.

The problem at the creation of custom field; it doesnt work issue types except "any issue type".

Batuhan,

Do you think you didn't configure the custom fields correctly? Is there anything special about your custom fields I need to know? I would suggest a quick test. Remove your custom fields from the issuse then add 1 custom field of the built-in types shipped with JIRA. Keep track of the steps you took. I would not suggest using a global context to make sure you have the right steps. If the new custom field shows up as expected in JIRA, then use those steps to add your custom fields back to the project. Follow this documentation:

https://confluence.atlassian.com/display/JIRA/Adding+a+Custom+Field

Once we know custom fields can be installed corretly and if the problem is still there then look more closely at the design and coding of your plugin.

Have you followed the create a custom field plugin for JIRA before succesfully?

Thank You Thomas,

I found the problem source.

FieldConfig fieldConfig = null;

if(issue == null)

{

fieldConfig = field.getReleventConfig(new SearchContextImpl());

} else

{

fieldConfig = field.getRelevantConfig(issue);

}

if i implement like this fieldConfig value becomes null and velocity renders nothing.


I changed it at below, by giving specific IssueTypeID i solved the problem.

FieldConfig fieldConfig = null

if(issue == null){

fieldConfig = field.getRelevantConfig(new IssueContextImpl(null,issueTypeID));

}else {

fieldConfig = field.getRelevantConfig(issue);

}

Is there any another effective way ? Thanks your care

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

79 views 0 5
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