Error occurs on deleted customfield when migrating Jira projects by using Project Configurator for Jira
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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
An error occurs on the deleted custom field when migrating Jira projects by using the 3rd party add-on Project Configurator for Jira:
/secure/launchUsedByReport.jspa [c.a.projectconfigurator.projectconfigserialize.ProjectConfigSerializingContext] [Project PCS] [Service desk PCS] [Request Type PCS Enquiries@@PCS Help] Trying to export Request Type found problem: Could not find object: Field with ID 'customfield_11104' used by Request Type 'PCS Enquiries'
com.awnaba.projectconfigurator.utils.errorhandling.ObjectNotFoundException: Could not find object: Field with ID 'customfield_11104' used by Request Type 'PCS Enquiries'
Environment
- Jira Service Management Server/Data Center on any version from 4.20
- Project Configurator for Jira
Diagnosis
- Identify the ID of the custom field that the error is complaining about (in the example of error above, the custom field ID is 11104
Access the URL below from the browser after replacing XXXXX with the custom field ID
<Jira_Base_URL>/secure/admin/EditCustomField!default.jspa?id=XXXXX
- If you get a 500 error, then it is an indication that the custom field with ID XXXXX does not exist, and in this case this KB article is relevant
Another way to check if the custom field with ID XXXXX does not exist is to run the SQL below against the Jira Database, after replacing XXXXX with the custom field ID:
select * from customfield where id = XXXXX;
- If the query does not return any result, then it also means that the custom field no longer exists and that this KB article is relevant
Cause
There is at least 1 Request Type configured in a JSM (Jira Service Management) project that is configured with a custom field that does not exist (custom field with ID 11104 in this example). This situation can happen because of the bug JSDSERVER-15464 - Getting issue details... STATUS .
Because of this bug, if a custom field is deleted from the Jira UI (via the page ⚙ > Issues > Custom Fields), references to this custom field will not be deleted from JSM tables such as AO_54307E_VIEWPORTFIELD and AO_54307E_VIEWPORTFIELDVALUE. As a result, these 2 DB Tables contains mapping information between Request Types and custom fields that no longer exist.
Solution
Please test the steps in the Dev/non-prod environment thoroughly before applying it in the production environment.
Before following these steps on a Production environment, please make sure to backup your Jira Database.
The steps below were tested with a PostgreSQL database, so you might have to modify the queries slightly for other types of database.
Here are the steps to resolve this issue:
- Stop the Jira application
- Take a backup of the Jira Database
Delete any reference to the custom field in the Database table AO_54307E_VIEWPORTFIELDVALUE by running the query below (make sure to replace XXXXX with the custom field ID):
DELETE FROM "AO_54307E_VIEWPORTFIELDVALUE" where "FIELD_NAME" = 'customfield_XXXXX';
Make sure that all the references to the custom field in that table are now gone, by running the query below and checking that it is not returning any result:
SELECT * FROM "AO_54307E_VIEWPORTFIELDVALUE" where "FIELD_NAME" = 'customfield_XXXXX';
Delete any reference to the custom field in the Database table AO_54307E_VIEWPORTFIELD by running the query below (make sure to replace XXXXX with the custom field ID):
DELETE FROM "AO_54307E_VIEWPORTFIELD" WHERE "FIELD_ID" = 'customfield_XXXXX';
Make sure that all the references to the custom field in that table are now gone, by running the query below and checking that it is not returning any result:
SELECT * FROM "AO_54307E_VIEWPORTFIELD" WHERE "FIELD_ID" = 'customfield_XXXXX';
- Start the Jira application
- Once these steps are performed, verify that the error messages are no longer showing in the Jira logs