Creating custom field during plugin installation


Anyone know how to make a plugin create a custom field, during installation. (like Greenhopper's rank, story, ect)

2 answers

1 accepted

1 vote

You're right, I didn't understand the question properly :-)

Anyway, it's fairly straightforward - get hold of the CustomFieldManager, create a new CustomField and then associate it with a screen using the FieldScreenManager, something like:

CustomField customField = customFieldManager.createCustomField(name, desc, type, searcher, contexts, issueTypes);         
// fetch the default screen
FieldScreen defaultScreen = fieldScreenManager.getFieldScreen(FieldScreen.DEFAULT_SCREEN_ID);
//don't add it if already added
if (! defaultScreen.containsField(customField.getId()))
   // just add the field to the JIRA List (which starts at 0)
   FieldScreenTab firstTab = defaultScreen.getTab(0);

Not sure you understood my question correct.
I know how to create a custom field plugin.

What im looking for is information about creating a field in JIRA (with a certin name, ect.) when im installing the plugin.
So if i create a plugin (myPlugin), with a custom field (myCF).

When i install myPlugin in our jira environment, it automaticaly creates a new custom field of myCF type, with a name, ect descriped within the plugin.

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 Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

175 views 0 4
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