Indexing breaks after upgrading to Advanced Roadmaps to Jira 3.29.2 when Team field was renamed or is missing
Platform Notice: Server and Data Center Only. This article only applies to Atlassian products on the server and data center platforms.
When Advanced Roadmaps for Jira (ARJ) custom field called Team was renamed, then after upgrading to ARJ 3.29.2, the index will break. This includes:
- Jira's full reindexing
- Any indexing action triggered by issue action, for example, creating issue, transitioning issue.
In atlassian-jira.log, we will see:
2020-12-13 19:21:15,186+0000 https-jsse-nio-8443-exec-166 WARN XXXXX XXXXxXXXXXxX XXXXXXX XXX.XXX.XXX.XX,XX.XX.XXX.XX /secure/WorkflowUIDispatcher.jspa [c.a.jira.index.AccumulatingResultBuilder] java.lang.IllegalStateException: Team custom field ID cannot be found java.lang.RuntimeException: java.lang.IllegalStateException: Team custom field ID cannot be found at com.atlassian.jira.index.DefaultIndex$Failure.<init>(DefaultIndex.java:100) at com.atlassian.jira.issue.index.DefaultIssueIndexer$EntityOperation.perform(DefaultIssueIndexer.java:838) at com.atlassian.jira.issue.index.DefaultIssueIndexer.lambda$null$4(DefaultIssueIndexer.java:513) ... Caused by: java.lang.IllegalStateException: Team custom field ID cannot be found at com.atlassian.rm.teams.customfields.team.TeamCustomFieldTypeHelper.getCustomFieldId(TeamCustomFieldTypeHelper.java:74) at com.atlassian.rm.teams.customfields.team.TeamCustomFieldType.getCustomFieldId(TeamCustomFieldType.java:44)
Run SQL query to verify the ARJ team fields
select * from customfield where customfieldtypekey = 'com.atlassian.teams:rm-teams-custom-field-team';
This by default should returned a custom field where cfname = Team
If the the returned result indicates cfname to be other than Team or if there are no results, this KB article is applicable to you.
In ARJ 3.29.2, in order for ARJ custom field to be included in Jira's indexing improvement, ARJ is referring to its fields by name.
Always consult with Atlassian support team to verify you steps, and always generate a backup prior to making any changes. Test this in your staging instance prior to implement this in your production instance.
- Unlock ARJ team field from database, following this KB article: Unlock a locked Jira Software custom field
- Rename the ARJ custom field back to its original name: Team.
- Lock the team custom field again, to prevent accidental changes in the future.
Renaming issue fields would affect the saved filters that refers them in JQL. Make sure to update the JQL of those saved filters as well.
- Stop your Jira nodes
- Perform a backup of your database
Run the following query to add the custom field on your database:
INSERT INTO CUSTOMFIELD (ID,CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, CFNAME, DESCRIPTION) VALUES ((SELECT max(id)+1 FROM CUSTOMFIELD),'com.atlassian.teams:rm-teams-custom-field-team', 'com.atlassian.teams:rm-teams-custom-field-team-searcher', 'Team','The team field. This custom field is created and required by Portfolio for Jira.');
- Start your Jira nodes and verify if the custom field is shown on page $Jira-URL/secure/admin/ViewCustomFields.jspa and that it's configurable on screens/projects;
- If everything on Step 2 worked and you can see the field correctly, please proceed with the next steps;
Get the new custom field ID by running this query:
select * from customfield where customfieldtypekey = "com.atlassian.teams:rm-teams-custom-field-team";
- Stop Jira again;
Lock the field on the table MANAGEDCONFIGURATIONITEM using the query below. Replace the customfield_<ID> below with the new custom field ID from the query above:
INSERT INTO MANAGEDCONFIGURATIONITEM (ID,ITEM_ID, ITEM_TYPE, MANAGED, ACCESS_LEVEL, SOURCE, DESCRIPTION_KEY) VALUES ((SELECT max(id)+1 FROM MANAGEDCONFIGURATIONITEM),'customfield_<ID>', 'CUSTOM_FIELD', 'true', 'LOCKED','com.atlassian.jpo:field-locking-service','admin.managed.configuration.items.generic.description.locked');
- Start your Jira cluster;
- Verify that the Team field is locked by visiting $Jira-URL/secure/admin/ViewCustomFields.jspa