Assets objects and attributes not loading for an Object Type
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
The objects and attribute details of an Object Type are not loading on the Assets schema view. The screen just continues to load forever or shows a blank screen. The issue is with only one object Type where other Object Type attributes and objects are loading fine.
Environment
All Jira Service management versions with Assets.
Diagnosis
1. Open the developer tools in your browser and check console logs. Then verify if you see the below error:
Uncaught TypeError: Cannot read properties of undefined (reading 'id')
at Object.<anonymous> (com.riadalabs.jira.plugins.insight:rlabs-insight-general.js?locale=en-IN:1890:63)
2. Export the affected object schema, decompress the exported zip file and open the schema.xml file contained. Verify all the attributes for the affected Object Type. If you see that there is any tag with the defaultTypeId set to -1, and with the type set to 0, then this KB applies:
- Example schema.xml for a corrupted attribute.
3. There could be some incompatible field values in the table "AO_8542F1_IFJ_OBJ_TYPE_ATTR" for the records corresponding to the object type.
The <type> tag in the above XML screenshot is set to 0, indicating that it is Text that we are capturing. Text is a Default Attribute type. In this above scenario, we see the defaultTypeId for the attribute is set to -1, which is non-default. This is incompatible with the Text Type 0. Note that can also happen the opposite situation where an attribute of type object (reference and non-standard) has instead defaultTypeId set to 0 and type non equal to 0.
Run the below query to identify all such corrupted records:
select "ID","DEFAULT_TYPE_ID" ,"NAME","REFERENCE_OBJECT_TYPE_ID","REFERENCE_TYPE_ID", "TYPE" from "AO_8542F1_IFJ_OBJ_TYPE_ATTR" where "OBJECT_TYPE_ID" = <OBJECT_TYPE_ID> and "TYPE" = 0 and "DEFAULT_TYPE_ID"= -1
In case you did not see any results for the above query. Please raise a support request to Atlassian, and share the output of the below query to Atlassian Support, so that they can check other possible data issues that could cause this problem.
select "ID","DEFAULT_TYPE_ID" ,"NAME","REFERENCE_OBJECT_TYPE_ID","REFERENCE_TYPE_ID", "TYPE" from "AO_8542F1_IFJ_OBJ_TYPE_ATTR" where "OBJECT_TYPE_ID" = <OBJECT_TYPE_ID>
Cause
We are unsure yet about the exact root cause that led to such a scenario. However, it seems that it could be due to data modifications directly performed against the Jira database.
If there are differences between the <type> tag in the XML and the result for the "TYPE" from the database query this will be caused by a corrupted cache. Following the steps outlined in How to clear Jira Data Center / Server plugin cache
Solution
We need to correct the data for the attribute that has incorrect values. Either we can convert the attribute to Text or a Reference to Object, depending on which attribute was the original one.
In order to convert the attribute to Text, please run the SQL as below.
update "AO_8542F1_IFJ_OBJ_TYPE_ATTR" set "DEFAULT_TYPE_ID" = 0 , "TYPE" = 0 where "ID" = <XX>
In order to convert the attribute to an object reference, please run the SQL as below.
update "AO_8542F1_IFJ_OBJ_TYPE_ATTR" set "DEFAULT_TYPE_ID"= -1 ,"TYPE" = 1 , "REFERENCE_OBJECT_TYPE_ID" = <EXAMPLE> , "REFERENCE_TYPE_ID" = <LINKTYPEID> where "ID" = <XX> ;
Please update the below in the SQL -
- XX to reflect the actual attribute ID that's impacted.
- EXAMPLE - Value to the objectType ID that you want to reference.
- LINKTYPEID - This is the ID of the link type to be used. eg: Dependency, Link, Reference etc.
Perform a clean Assets reindex, and refresh the page to see the attributes on the impacted Object Type.
If the corrupted attribute is converted to Text type, the attributes appear like below:
If converted to a Reference attribute, the attributes appear as below: