Adding a custom field automatically

I created a new custom field, I kept it simple for now. My new custom field extends GeneticTextCFType and only delcares the constructor.

I declared the <customfield-type> in my atlassian-plugin.xml file, and I am now able to manually create a custom field of that type.

I created a custom field searcher that extends TextSearcher, with nothing in it.

Ideally, I would like the custom field that I created manually to exist automatically. Do I check for its existence in the PluginEnabledEvent and create it there if it does not exist? When do I remove it? when the plugin is uninstalled? I doubt it a little because all data would be lost if the custom field is deleted.

I tried creating it in the afterPropertiesSet function, but the CustomFieldType does not seem to exist at that point... At other points in the plugin, ComponentAccessor.getCustomFieldManager().getCustomFieldTypes() gives me a list of types with my new custom field type in it.

At which point in the plugin should I create my custom field using that customfield type?

0 comments

Comment

Log in or Sign up to comment
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

815 views 2 19
Join discussion

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