Post migration we have ended up with unwanted custom fields which were part of default field configuration .
Is there a way I can bulk delete Custom fields in Jira cloud ?
How about I use scriptrunner script to delete unwanted custom fields . I found this info about Customfieldmanagerinterface and there is function "removeCustomField(CustomField customField) " Can i use this in loop and delete?
Hi, I love the idea of using Scriptrunner (especially if you have it), but I don't think that'll work.
The API you reference is for server, but even more importantly, it's an internal API. Scriptrunner on Cloud can only talk to REST APIs.
And from this bug, it appears that there is no REST API for deleting a custom field: https://jira.atlassian.com/browse/JRACLOUD-28539
However, I just tested the CLI command I posted above, and it worked, so I have to assume that @Appfire Support is using the undocumented APIs/endpoints that @Peter Majeed discovered and documented in that ticket:
Below are some workarounds I found useful as of 2020-11-17.
There's an undocumented REST API for trashing fields.
POST https://your-company-name.atlassian.net/rest/api/2/field/customfield_xxxxx/trashOnce you trash a field, it will be deleted after 60 days. To permanently delete the field, not sure if there's a REST API, but Jira currently uses an undocumented jspa page to do this. You will need a token from the browser to execute this request.
POST https://your-company-name.atlassian.net/secure/admin/DeleteCustomField.jspaFormData: id=xxxxx&Delete=Delete&atl_token=browser_tokenBottom line: I don't think you'll be able to do it with Scriptrunner, but... it wouldn't cost you anything to try it with CLI.
For reference, here's a transcript of my testing session:
$ acli --action removeCustomField --field "Multi"
Custom field 'Multi' removed. Field had id customfield_10078.
I'll note that the field was deleted. It does not show up in the new "Trashed" tab for Custom Fields. (Hey @Appfire Support that might be a nice feature to offer.)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The Cloud field API endpoint does now support deleting custom fields:
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-fields/#api-rest-api-3-field-id-delete
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There's no way to bulk delete custom fields within Jira itself.
But you could put together a shell script/batch file that uses Atlassian CLI to run several removeCustomerField commands:
https://bobswift.atlassian.net/wiki/spaces/JCLI/pages/1059398143/removeCustomField
Example (after you've installed and configured it. By the way, I highly recommend setting up a configuration property file):
acli --action removeCustomField --field "Field You Don't Need" --continue
acli --action removeCustomField --field "Another Field You Don't Need" --continue
acli --action removeCustomField --field "Unneeded field" --continue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
fyi... the --continue on the removeCustomField action is just a way to ignore a not found error so you can run your script multiple times if needed if you add more fields later when testing.
Also, a slight improvement would be a single command:
acli -a runFromList --list "Field You Don't Need, Another Field You Don't Need, Unneeded field" --common "-a removeCustomField --field \"@entry@\" --continue"
Note: use "" instead of \" to do escaping on windows.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There are now 2 REST endpoints that allows you to get the list of custom fields in the trash, and delete them.
A python script can be quickly implemented to 1) get the list in the trash and; 2) iterate over the list to delete each custom field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This feature is not available yet.
The request is open here, https://jira.atlassian.com/browse/JRACLOUD-37773
Thanks,
Pramodh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Need this now...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.