Assets CF values in Jira issues hold an object, but issues are not showing in the Related Jira issue panel and Connected tickets tab when viewing the object
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
Assets Custom fields added to the Jira screens contain Assets objects but the connected issues are missing from the Connected Tickets tab (in object view) and the Related Jira issues panel (in detail view)
Environment
- Assets / Insight Asset Management
- Custom scripts such as Groovy
Diagnosis
- From the Jira issue navigator, perform an issue search with the affected Assets custom field and an object with at least one Jira issue connected. Alternatively, check the Search Template of the Assets custom field. Assets object searcher should be selected for the Assets custom field.
- To check the Search Template of a custom field, you can follow the steps in Edit a custom field.
- Check if the connection between the object and the Jira issue(s) is stored correctly in the database. Please run the below queries in your Jira database:
- To check if the object has been stored correctly as a custom field value for the given Jira issue(s).
Get a list of Jira Issues, where a specific object is added to Assets Custom fields. You need to replace ? for your Assets Object Key.
SELECT * FROM "customfieldvalue" WHERE "stringvalue" = ?
- It returns a list of issues where Object is added to Asset Custom fields. In the below example, Object Key TES-1 is added to two issues (10101 and 10103) using the same Asset custom field (10107)
The 'issue' column is not the same as the Issue Key you see on the Connected tickets tab. You need to convert the 'issue id' from the Jira User Interface. Please refer to How to get issue id from the Jira User Interface
id
issue
customfield
updated
parentkey
stringvalue
numbervalue
textvalue
datevalue
valuetype
10211
10101
10107
1667982235112
TES-1
10214
10103
10107
1667982578938
TES-1
Check a specific Object to see its Connected tickets from Assets. You need to replace ? for your Object ID. For this example, we use Object TES-1 and the Object Id is 1
SELECT * FROM "AO_8542F1_IFJ_OBJ_JIRAISSUE" WHERE "OBJECT_ID" = ?
Expected results: 2 Issues Key are displayed in the Connected Tickets in Assets UI
CUSTOM_FIELD_ID
ID
JIRA_ISSUE_ID
OBJECT_ID
10107
25
10101
1
10107
27
10103
1
Unexpected results: JIRA_ISSUE_ID 10103 is missing from AO_8542F1_IFJ_OBJ_JIRAISSUE
CUSTOM_FIELD_ID
ID
JIRA_ISSUE_ID
OBJECT_ID
10107
25
10101
1
- To check if the object has been stored correctly as a custom field value for the given Jira issue(s).
Cause
Cause 1
The search templates, which are responsible for indexing a custom field and making the field searchable in basic and advanced issue search, have not been configured correctly for the Assets custom field and hence, the issues are not showing up as expected when viewing an object.
Cause 2
Let's understand how values are stored in the database.
- Assets Connected tickets are saved in the Assets "AO_8542F1_IFJ_OBJ_JIRAISSUE" table.
- Jira's Assets CF Values (Assets Objects Key Name) are saved as string values in the "customfieldvalue" Jira table.
In the example exposed in this article, AO_8542F1_IFJ_OBJ_JIRAISSUE table is missing a row for JIRA_ISSUE_ID 10103. It means that the Connected Ticket tab will not display the Issue ID but on the Issue itself, an object is added to Asset Custom Field.
This issue can happen if you use custom scripts such as Groovy script to update Custom fields.
If a customfield (com.atlassian.jira.issue.fields.CustomField) is updated via JAVA API, customField.updateValue(null, issue, new ModifiedValue(oldValue, newValue),changeHolder) - this is without a history entry, column AO_8542F1_IFJ_OBJ_JIRAISSUE.OBJECT_ID does not change accordingly and it will keep the old field value.
The API only works well with Custom fields using JIRAISSUE DB tables but Assets CF uses AO_8542F1_IFJ_OBJ_JIRAISSUE which is not a JIRAISSUE DB table. This is expected as described on our JAVA API documentation:
Fields that are simply stored in the JIRAISSUE DB table, need not do anything here as this table is written to one time to include all fields that changed. Fields using other DB tables must update that table with the appropriate values.
Solution
For cause 1, change the search template to Assets object searcher and run a Jira re-index.
For cause 2, you need to edit the affected issues and save the changes. This will trigger a Jira event and AO_8542F1_IFJ_OBJ_JIRAISSUE table will be updated accordingly.
- To resolve the behavior, there are different approaches to tackle this issue:
- If you use customField.updateValue method, you need to look after other tables involved such as AO_8542F1_IFJ_OBJ_JIRAISSUE
- Use another method as issue.setCustomFieldValue to update Custom fields
- Using this method, Issue history is kept