How to Exclude objects from Asset field selection
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
An administrator wants to exclude an Assets object from the dropdown selection of an Assets field.
There are multiple ways to achieve this, the below examples describe 2 scenarios:
An administrator wants to exclude a single object
An administrator wants to exclude multiple objects
Environment
Tested on versions 8.20.12 and 9.6.0
Scenario
In this example, an administrator wants to perform the exclusion of a single network interface (interface test 0). and exclude multiple network interfaces (interface test 0 and interface test 1).
The below configuration is used to achieve the results.
Custom field: custom_field
Schema: IT Schema
Object type: Network interface
Object names: test interface 0 & test interfce1
Attribute: attribute-test
Attribute value: AT1
Expected behavior
After creating a custom field (custom_field) with the type Asset object and configuring it to display the desired object type (Network Interface):
We are able to create a new issue in the project using any network interface from 0 to 9 :
Solution
Single object exclusion
If a single object is required to be excluded, one option to perform this is to exclude the object by objectid.
ℹ️ (You can find the objectid on the object page, you should use the number without the key)
In the below example, the ID is 112:
We can then exclude it using the Filter Scope (AQL) query, in this case, we are using
objectid!=112
to include anything not matching the objectid:
As a result, the Network Interface 0 object is not an option on the selectable object for the field:
Multiple objects exclusion
If multiple objects are desired to be excluded we can add an attribute to the required objects and filter them out of the search results.
In the Assets objects attributes we can create an attribute (attribute-test):
Add the attribute value to the desired objects (AT1):
We can then exclude it using the Filter Scope (AQL) query, in this case, we are using
attribute-test!=AT1
to include anything not matching the AT1 attribute:As a result, the Network Interface 0 and Network Interface 1 objects are not an option on the selectable objects for the field:
Multiple filter criteria can be configured to achieve more complex/granular results if desired, the above serves as a guide to demonstrate the functionality.
Was this helpful?