How to create an Assets object attribute with unique values and default Option
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
In this article, we are addressing a scenario where we need unique values to be chosen and if none of the unique values are applicable we should be able to choose a default value for multiple objects.
Problem
We have an attribute "SerialNumber" where we are storing serial numbers of the products which should be unique, but sometimes we want to provide with a value "None" when the serial number is not applicable for a product. When we use "Unique" on an Insight attribute configuration, we won't be able to provide a value more than one time.

Environment
Jira Service Management or Jira Software and Insight - Asset Management
Solution
We shall use the below steps to achieve this requirement where we have a unique value for an attribute and also have an option to use a default value.
Create an objectType "UniqueNumber" and create objects for each Serial Number with the Name of the Object matching the Unique Number
Create an Object with the Name "None" in the objectType "UniqueNumber"
Map the respective attribute to refer to the ObjectType "Serial Number" by having "Type" as "Object" & "Type Value" as "UniqueNumber"
In the attribute configuration, you shall have IQL in "Filter Objects" as below
1
Name = "None" or Object not HAVING inR() or object HAVING inR(Key=${Key})
This would not allow any duplicate unique Number values except "None".
Was this helpful?