Filter Jira Assets Field Using Multiple Object References in Jira Cloud
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
Filter objects in an Assets field based on another Assets field's selection using AQL. Learn how to configure this when multiple objects are stored.
This article covers JSM Cloud. For Data Center, use JSM Data Center — configure Assets Object custom field based on another Assets Object custom field instead.
Solution
Filter Assets Using AQL Based on Multi-Object Fields
Imagine you have a custom field called "Servers" that retrieves multiple items from a category named "Server". Another custom field, 'Impacted Services,' retrieves items from the 'Services' category. The "Server" category includes an attribute called 'Provided Services,' which links to the 'Services' category.
When you select Server A and Server B objects in the custom field "Servers," the "Impacted Services" field should only show the Services objects referenced by these two servers, service1 and service2.
Configure the Servers custom field:
Object schema: ITSM
Filter scope (AQL): Objecttype = Server
Filter issue scope (AQL): None
Field can store multiple objects: Yes
Configure the Impacted Services custom field:
Object schema: Services
Filter scope (AQL): objecttype = Service
Filter issue scope (AQL): object HAVING inboundReferences(objecttype = Server AND objectId IN (${customfield_10127${0}}))
Replace
10127with your driving Assets field's custom-field ID. Set Field can store multiple objects: Yes, on the driving field.
Additional tip
When using another Assets object custom field in the Filter issue scope AQL:
${customfield_xxxxx}retruns the Object ID and can be used in Filter issue scope AQL as "objectId =${customfield_xxxxx}"If the field holds multiple values, the placeholder can return a single value by using an index "(
${customfield_xxxxx${1}})" or it can return all of the values at once by using a query like "objectId IN (${customfield_xxxxx${0}})"${customfield_xxxxx.label}returns the value stored in the object label and can be used in Filter issue scope AQL as "objecttype = Server AND Name =${customfield_xxxxx.label}"${customfield_xxxxx.label${0}}returns all the values stored in the object label and can be used in Filter issue scope AQL as "objecttype = Server AND Name IN (${customfield_xxxxx.label${0}})"
Also, please take note of this bug that might affect the way you browse for the objects JSDCLOUD-10496.
To confirm it's working, on a test issue, select multiple objects in the driving field and confirm that the dependent field shows only the referenced objects.
Reach out to Atlassian support for additional questions https://support.atlassian.com/contact/
Was this helpful?