Nonexistent options for custom field of type Select List (cascading) showing in Jira Statistic and other Gadgets
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
For a cascading custom field the Jira Statistic Gadget displays results, that are not part of the configured options. This can also happen with 3rd party gadgets i.e. when using the Rich Filters for Jira Dashboard plugin from Qotilabs
Diagnosis
Find the customfield ID for the affected field (see How to find id for custom field(s)? )
Run the following query (substitute <customfield_id> with the ID from step 1
1 2 3 4 5 6
select p.pname, p.pkey, j.issuenum from jiraissue j join project p on p.id = j.project where j.id in (select c.issue from customfieldvalue c where c.customfield = '<customfield_id>' and cast (c.stringvalue as integer) not in (select o.id from customfieldoption o where o.customfield = '<customfield_id>' ));
Check on the issues, and verify it contains valid and correct data.
Cause
The database contains invalid options for the cascading select list. The configuration and possible selections for this field have changed either by directly changing the custom field, or due to importing data. This left incorrect rows in the database, that are picked up by the gadgets.
Solution
To fix this situation you will need to remove the data directly from the database
Always back up your data before making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Shut down Jira (ensure you have a backup just in case)
Run the following db query to remove all rows containing faulty data:
1 2 3 4
delete from customfieldvalue c where c.customfield = '<customfield_id' and cast (c.stringvalue as integer) not in (select o.id from customfieldoption o where o.customfield = '<customfield_id' );
substitute <customfield_id> with the ID of the custom field as obtained during the diagnosis step.
Restart Jira
Run a reindex
Check on the gadget.
Was this helpful?