How to register Custom Field Plugin to the JIRA's 'Custom Fileds'

Akira Tsuchiya
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.
March 26, 2013

I created a Custom Field Plugin and installed it successfully.

But the custome field does not appear in the JIRA [Administration] -> [Issues] -> [Fields] -> [Custom Fileds].

How can I do it programmtically?

1 answer

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 26, 2013

To be clear here, have you developed a "Custom field", or a "custom field type"?

Most custom field plugins provide a field type, not a field, as you usually want to let the administrators add the actual field (they decide on name, screens, context and so-on), and often you want more than one.

To clarify, do you see your field type when you go to

JIRA [Administration] -> [Issues] -> [Fields] -> [Custom Fileds] -> add new field ?

Or did you really write a new hardcoded field?

Akira Tsuchiya
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.
March 26, 2013

Probably I created a 'Custom Field Type' without knowing it.

I created the plugin module referencing to the page below.

https://developer.atlassian.com/display/JIRADEV/Custom+Field+Plugin+Module

I described the tag belowin the atlassian-plugin.xml.

<customfield-type/>

There is no entry in the [Administration]'s [Custom Fields].

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 26, 2013

I thought that might be the case - plugin *types* are quite common and are what is listed in the example codes, even if the target system only needs a single instance of them. Because they're more common, we're more familiar with the debugging of them.

The things to check are:

  • That you are offered the type of field when you add a custom field (you've just done this, and you're not offered it)
  • That the plugin appears on the list when you go Admin -> Plugins, to check it's installed ok
  • That the plugin appears on the list when you go Admin -> Plugins, and shows as "enabled"
    • If it is not enabled, try clicking enable and read any error messages as they'll tell you why it's not enabled
  • Read the log file, specifically for
    • The times around when you tried any of the above
    • When Jira started up, as it will try to load all the plugins at that point and error on failures
    • Search for the name of your plugin classes
Akira Tsuchiya
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.
March 26, 2013

1. The Plugin is successfully installed.

2. The Plugin is successfully enabled.

3. There is no error in the log.

4. But JIRA Administration does not detect the Custom Field.

So I suspect that there is something missing in the source code.

I list the full source below.

Please tell me where I misunderstand.

1. Java Class

public class LuminousTextArea extends TextAreaCFType {

public LuminousTextArea(
CustomFieldValuePersister customFieldValuePersister,
GenericConfigManager genericConfigManager) {
super(customFieldValuePersister, genericConfigManager);
}
}

2. atlassian-plugin.xml

<customfield-type key="customFieldTest"
name="Custom Field Test"
class="***.LuminousTextArea">
<resource type="velocity" name="view"
location="templates/view.vm"/>
<resource type="velocity" name="edit"
location="templates/edit.vm"/>
</customfield-type>

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 26, 2013

Hmm, that all looks correct to me. I think point 3 is worth chasing further though - there should be references in the log file to the attempts to load the plugin and the classes it tries to load. Even if they are not throwing specific errors, it is well worth checking that they are being spotted and loaded ok...

For example, this one:

    JIRA Misc Workflow Extensions                 : com.innovalog.jmwe.jira-misc-workflow-extensions
          Version                                       : 2.5.7.1
          Status                                        : enabled
          Vendor                                        : Innovalog
          Description                                   : Several JIRA workflow extensions

Akira Tsuchiya
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.
March 27, 2013

Sorry, I must clarify this issue again.

I created a Custom Field Type, I guess.

In the JIRA5.x [Administration] -> [Issues] -> [Fields] -> [Custom Fileds] -> [Add Custom Field],

the just created Custom Field Type is successfully listed.

But I want to do the second step programatically so that the Custom Field is listed

in the JIRA5.x [Administration] -> [Issues] -> [Fields] -> [Custom Fileds].

I want to know how to assign applicable Issue Types, Projects, and Screens to the just

created Custom Field.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 27, 2013

So you managed to fix the problems with the plugin not making the new type available?

Now the question has moved on to adding a new field of that type automatically?

I'd suggest you think very carefully about that - do you really want a plugin to add a field type without the administrators being involved in the selections of where it lands? Of course, you can do it, but the only plugins I know of that do it are all bug-ridden with the process (even Atlassian's own Greenhopper creates problems when it tries to do it - the latest version can duplicate the field "Story Points" when you upgrade), and that makes me think it's a lot of complex work, possibly with little reward. I'm inclined to tell you to trust your administrators instead of coding for complex situations.

Akira Tsuchiya
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.
March 27, 2013

Thanks a lot.

Suggest an answer

Log in or Sign up to answer