How to create an Insight attribute with unique values and default Option

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

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.

  1. Create an objectType "UniqueNumber" and create objects for each Serial Number with the Name of the Object matching the Unique Number
  2. Create an Object with the Name "None" in the objectType "UniqueNumber"



  3. Map the respective attribute to refer to the ObjectType "Serial Number" by having "Type" as "Object" & "Type Value" as "UniqueNumber"



  4. In the attribute configuration, you shall have IQL in "Filter Objects" as below


    Name = "None" or Object not HAVING inR() or object HAVING inR(Key=${Key})
  5. This would not allow any duplicate unique Number values except "None".





Last modified on Oct 19, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.