I'm trying to build an AQL query without restricting it to a specific objectType, and instead query objects based on attribute values.
My use case is to search across multiple object types using two attributes:
The first condition works as expected:
It returns matching objects across different object types
However, when I add the second condition using the custom field reference:
the query does not return the expected results.
Is there any limitation when using a Jira custom field variable within an AQL query that is not scoped to a specific object type?
Has anyone successfully used a custom field placeholder such as:
for attribute matching across multiple object types? If so, are there any prerequisites or alternative syntax that should be used?
Any guidance would be appreciated.
Observation regarding Assets AQL validation in Forms Designer vs JSM Portal
I initially thought there was an issue with my AQL query because the results were not being filtered correctly during testing.
However, after further investigation, I realized the AQL itself was working as expected.
The confusion came from where I was validating the query:
So, in my case, the issue was not with the AQL syntax or field configuration. The behavior in the Forms Designer preview did not accurately reflect the filtering behavior seen in the live portal.
Has anyone else observed differences between the Forms preview and the actual JSM portal when using dependent Assets fields and AQL filters?
Hello @Sathishkumar S
Welcome to the Atlassian community.
What is the context of running this query? Are you within and Automation flow? If so, please show us the flow in its entirety. Is it an AQL within a Custom Asset Object field? If so, please show us the entire configuration for the field.
Are the object types all within a single schema, or are you also trying to search across schemas?
What type of custom field is customfield_XXXX? That syntax is a reference to a custom field within Jira, vs. Assets, so there should be a custom field type/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Trudy P Claspill
Thank you for your response.
The AQL query mentioned here is not being used in an Automation rule. It is being used within a Custom Asset Object Field.
All the object types involved are located within the same Assets schema.
The referenced field (customfield_XXXXX) is also an Assets custom field. We are attempting to use its selected value as a dynamic filter in the AQL query.
The first condition works as expected and returns objects across multiple object types. However, the part referencing the Assets custom field value does not seem to be evaluated correctly.
Any insights on whether there are limitations or specific syntax requirements when using an Assets custom field reference in an AQL query for a Custom Asset Object Field would be greatly appreciated. Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Additional Info:
When i tried with hard coded value instead of customfield_xxx reference, it worked as expected on Filter scope.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you post a screenshot of the context of the field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is the filter you are trying to address the Filter work item scope (AQL) filter in your screen image?
If so, do I understand that you have verified that if it contains only the first part, then you get the correct list?
objectType=${customfield_10866.label}
If so, do I understand that it is when you add the second part you end up getting no results at all?
AND "Instance" = ${customfield_10734.label}
If I have that correct:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi @Sathishkumar S ,
Did you try to add quotes, like this:
"Attr2".Name = "${customfield_XXXXX.label}"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Rudy Holtkamp ,
Yes, tried with quotes but ends up with Syntax error.
Even with other combinations like moving the query to Filter Scope to Filter Issue Scope.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm looking at some of my asset fields. Which is used to find laptops that are assigned to a department. The department is set in customfield_10102.
So maybe this gives you an insight:
In Filter scope (AQL): objecttype = Laptops
In Filter work item scope (AQL): assigned IN ($customfield_10102)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've taken a look at the screenshot.
Maybe change the Filter work item scope to:
objectType = ${customfield_10866.label} AND Instance in ($customfield_10734.label})
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Suppose if the object Type to get from the customfield instead of hardcoded value as Laptop. That is my use case (one part).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is customfield_10866 for type of field, what values does it contain?
If it is another object and you want to get the type and use it in a second field, you can use:
objectType = ${customfield_10866.objecttype} AND
Instance in ($customfield_10734.label})
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Even this query not working. Listing down all the objects in the schema
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Syntax Error, when using objecttype instead of label
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.