How to filter Assets object within a issue based on other object custom field storing multiple objects

Still need help?

The Atlassian Community is here for you.

Ask the community

 

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

   

Summary

There are scenarios when you want to filter objects returned in an Assets object field based on the object selected in another Assets object field. As per our documentation Configure the Assets object field you can use the Filter Issue Scope (AQL) to achieve this. This kb explains how this can be achieved when the field based on which the FIS needs to be created stores multiple objects

Solution

Lets say you have an Assets object custom field "Servers" that fetches objects from Server object type and can store multiple objects. You have another Assets object custom field "Impacted Services" that fetches objects from Services object type. Server object type has a referenced attribute Provided services  that has an outgoing reference to the Services object type. 


When you select Server A and Server B objects in the custom field "Servers", the "Impacted Services" custom field should only show the Services objects that are referenced by these two servers, service1, and service2.

  1. Configure the Servers custom field:

    Object schema: ITSM

    Filter scope (AQL): Objecttype = Server

    Filter issue scope (AQL): None

    Field can store multiple objects: Yes

  2. Configure the Impacted Services custom field with the following Filter issue scope where 10127 is the custom field id of the Servers field:

    Object schema: Services

    Filter scope (AQL): objecttype = Service

    Filter issue scope (AQL): object HAVING inboundReferences(objecttype = Server AND objectId IN (${customfield_10127${0}}))

    Additional tip

    When using another Assets object custom filed in 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}})"

    (warning) Also please take note of this bug that might affect the way you browse for the objects JSDCLOUD-10496 - Getting issue details... STATUS

Reach out to Atlassian support for any additional questions https://support.atlassian.com/contact/



Last modified on Jan 29, 2024

Was this helpful?

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