Attempting to delete a User Picker or Group Picker custom field shows "We couldn't delete these fields. Try refreshing the page, and delete them again."

Still need help?

The Atlassian Community is here for you.

Ask the community

   

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

As a Jira admin when you attempt to delete a User Picker or Group Picker custom field, under certain circumstances you might run into this error on the UI:

In text format:

(warning)We couldn't delete these fields

Try refreshing the page, and delete them again.

This article aims to elaborate on possible reasons that may prevent you from deleting a User Picker or Group Picker custom field, as the error message does not provide a specific cause for the inability to delete the custom field.

Environment

Jira Data Center 

Diagnosis

Looking at the application logs you'd see the following entry which is also a generic warning message and does not point to any specific blocker for this operation:

2024-05-07 07:22:52,652+0000 http-nio-8080-exec-3 url: /jira/rest/api/2/customFields;
 user: admin WARN admin 442x155x1 b4770o 1.1.1.1,2.2.2.2 /rest/api/2/customFields [c.a.j.issue.managers.CustomFieldBulkDeleteManager] 
You cannot delete customfield_12345: Validation for custom field deletion failed.

We do have an Improvement Request logged already to make the error message more specific so that it helps the Jira admin identify what exactly is the reason behind the validation failure.

JRASERVER-77471 - Getting issue details... STATUS

Cause

There are a few validation checks Jira performs before allowing an Admin to delete a custom field to make sure it's not allowing a delete operation that might result in data loss or configuration malfunction. When it comes to User Picker or Group Picker custom field types, this becomes even more relevant since things like Permission Schemes, Issue Security Schemes, etc., might be tied to these types of custom fields. If any of these validation checks fail, Jira will throw the error above (screenshot) on the UI and log this generic warning message in the application logs and stop the delete action.

Here's a list of validation checks before Jira would allow you to delete a custom field:

  1. Is the user attempting the delete an admin user? (tick)
  2. Does the custom field actually exist with the given custom field ID? (tick)
  3. Is the custom field used in any Permission Scheme(s)?
    • Project permissions are created within permission schemes, which are then assigned to specific projects by Jira Administrators. Project permissions can be granted to:

      • ...
      • A multiuser picker custom field.
      • A multigroup picker custom field, which is either an actual group picker custom field or a multiselect list where values are group names.
  4. Is the custom field used in any Issue Security Scheme(s)?
    • A security level's members may consist of:



We can ignore checks #1 and #2 in this context since we would not be here without the Jira admin attempting the delete action of a custom field from the UI. So let's focus on the #3 and #4 validation checks. If the User Picker or Group Picker custom field is used in any Issue Level Security Schemes and/or Permission Schemes - Jira will not allow you to delete the custom field until the field is removed from all applicable Scheme(s). 


Solution

Since in a production instance there can be many Issue Security Schemes and Permissions Schemes, browsing through each one of them to find if any of them mentions the Group/User Picker custom field can be a very hectic job. You can identify this easily by using the following SQL queries to identify the applicable Schemes.

  • Identify and remove the custom field from any Permission Scheme(s)

    • To find if the User Picker custom field is mentioned in any Permission Schemes:

      SELECT * FROM schemepermissions sp 
      LEFT JOIN permissionscheme ps ON sp.SCHEME = ps.ID
      WHERE sp.perm_type = 'userCF' AND sp.perm_parameter = 'customfield_12345';
    • To find a Group Picker custom field is mentioned in any Permission Schemes:

      SELECT * FROM schemepermissions sp 
      LEFT JOIN permissionscheme ps ON sp.SCHEME = ps.ID
      WHERE sp.perm_type = 'groupCF' AND sp.perm_parameter = 'customfield_12345';

            (info) Replace the "12345" with the actual Custom Field ID. If the query returns any row(s), you will find the specific Permission Scheme in the "name" column along with the type of permission in the "permission_key" column.

    • Log in as a Jira admin and remove the custom field from the Permission Scheme(s) to be able to delete the custom field.


  • Identify and remove the custom field from any Issue Security scheme(s)

    • To find if the custom field is mentioned in any Issue Security scheme(s):

      SELECT * FROM issuesecurityscheme iss
      JOIN schemeissuesecurities sis ON iss.id = sis.scheme
      WHERE sis.sec_parameter = 'customfield_12345';

            (info) Replace the "12345" with the actual Custom Field ID. If the query returns any row(s), you will find the specific Issue Security Scheme in the "name" column.

    • Log in as a Jira Admin user and remove the custom field from the Issue Security scheme(s) to be able to delete the custom field.




Last modified on May 7, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.