Uninstall Cleanup - Remove Custom Fields created during uninstall?

Is it possible to remove or reset the custom fields created by a Connect Add-on during uninstallation?

My app descriptor creates two fields that I populate with specific options after installation (using the shared secret/client secret receiving during the installation callback). Since my add-on is still in development, is it possible to completely remove the custom field(s) that the add-on created so I can recreate it during the next install? Or do I have to make sure that I run “Update” instead of “Create” once I’ve installed the app and populated its custom field?

Hi @david.gunter,

You can extend the “uninstall” lifecycle by adding it to your router or controller and add logic there. However, I don’t think you can delete them, please see this feature request: JRACLOUD-28539

Cheers,
Anne Calantog

Hi, @david.gunter,

I believe you’re talking about Connect issue fields, is that correct?

I see a few options.

You can change the key of your custom field after your app reaches its final state. This way your field will be always created anew with fresh configuration.

Another way would be to get all options upon app instalation (with GET /rest/api/3/field/{fieldKey}/option) and then delete them one by one with DELETE /rest/api/3/field/{fieldKey}/option/{optionId}. You might want to deselect all options from issues first with DELETE /rest/api/3/field/{fieldKey}/option/{optionId}/issue.

Best regards,
Krzysztof

@acalantog & @kkercz: Thank you both for the replies!

As far as “extending the uninstall lifecycle”, I thought that the secrets created during the install lifecycle are invalidated during the uninstall so I wouldn’t be able to make further JIRA API calls after I receive that uninstall request? Unless I’m misunderstanding.

You can change the key of your custom field after your app reaches its final state.

Could you elaborate on this? Do you mean when I receive the uninstall lifecycle call?

No, I meant the key of the issue field module in your app descriptor. If your app is still in development I’m assuming it’s not published on the marketplace. So you can freely change your keys and not worry about inconsistent data. You could even change your app key to reset all the state.