Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Creating custom field during plugin installation

Mikkel Kragelund Nielsen
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 12, 2012

Hey

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
Answer accepted
tier-0 grump
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 14, 2012

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);
   firstTab.addFieldScreenLayoutItem(customField.getId());
}

0 votes
tier-0 grump
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 14, 2012
Mikkel Kragelund Nielsen
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 14, 2012

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
TAGS
AUG Leaders

Atlassian Community Events