When a (new) custom field context is created for a custom field of type Select List (single choice), JIRA creates the following entries in the database:
- 1 entry in table fieldconfiguration to store the context itself
- 1 entry in table fieldconfigscheme to store the context scheme
- X entries in table fieldconfigschemeissuetype to link the above 2 together, plus the issue type context (restricted to which issue type/s)
- X entries in table configurationcontext to store the project context (restricted to which project/s)
- X entries in table customfieldoption to store the number of options
- 1 entry in table genericconfiguration to store the default value (if any)
For example, this custom field context (created when custom field is created):
has these entries in the database:
The relationships between the tables and columns are as follows:
- fieldconfigscheme.id = fieldconfigschemeissuetype.fieldconfigscheme = configurationcontext.fieldconfigscheme
- fieldconfiguration.id = fieldconfigschemeissuetype.fieldconfiguration = genericconfiguration.datakey
- fieldconfiguration.id = customfieldoption.customfieldconfig
According to the above, there's no relationship between fieldconfigscheme.id and fieldconfiguration.id, and they do mismatch. Currently, when JIRA needs to look up customfieldoption.customfieldconfig for available options, it fails because it incorrectly uses fieldconfigscheme.id instead of fieldconfiguration.id, leading to options not found.
So far this is known to cause only Project Import problem, as in JRASERVER-63226.
- Create a custom field as in the above example
- Modify the database to make fieldconfigscheme.id differ from fieldconfiguration.id:
This is for testing purpose only, but it happens in real situations.
- Restart JIRA for the change to take effect
- Create an issue that the field is available for, and give the field a value in that issue e.g. Peugeot
- Create an XML backup
- Delete the issue in step 4 to make the project ready for project import
- Use the backup in step 5 to perform a project import
There's no validation error regarding the custom field options, because the custom field exists with exactly the same context and options.
JIRA says it can't find the option Peugeot needed to import the issue:
JIRA uses 99999 to look up the options, but the options use 10500.
It's possible to modify the entities.xml and update customfieldoption.customfieldconfig with fieldconfigscheme.id. In this example, find the following lines:
and replace them with:
Then save the file, zip it back, and use the zip to perform project import.
The modified zip file should only be used for project import. Once done, it should be destroyed as the custom field configuration association is already messed.
For more details, please refer to Project Import fails due to missing Custom Field Options.