Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

AQL Query to retrieve Organization of a ticket

AV
Contributor
February 21, 2023

I spent pretty much the entire day trying to get this to work, but the information I find is all over the place, and nothing seems to work.

What I want to achieve is quite simple:
- I have a custom field of the type Asset Object

- this field displays all kinds of assets from Jira Asset Management

- one of the attributes i have there is "ShowForOrganization", let's say it has values "CompanyA" or "CompanyB" which i enter as text.

When a user part of an Organization, reports a ticket, the Organization is shown (lets say "CompanyA".

In the Filter Scope (AQL) of the above named Asset field, I want to only show those objects for the Organization shown in the ticket.

So if I try this and manually enter a value in my AQL, it works fine:
Objecttype = Company AND ShowForOrganization = "CompanyA"


But actually getting the value out of the Organizations field proves to be a huge challenge so far, I tried everything I can think of, all kind of examples I found, but i can't get it to work.


I tried using:
currentUser.organizations.name
issue.fields."Organizations"
organizations
IN (${customfield_10002${0}})

 

Can someone 'show me the way' ? :)

1 answer

0 votes
Riley Venable
Community Champion
February 21, 2023

You can use the field labels and/or IDs to refer to Jira fields. For example, if you wanted to only show a list of assets owned by the current Organization, you could configure the Filter Issue Scope (AQL) field by typing objectType = “Company” AND "ShowForOrganization" LIKE ${customfield_10002.label}. In this case, each asset would have a “ShowForOrganization” attribute that corresponds to the name of the Organizations in Jira.

AV
Contributor
February 21, 2023

I tried this in the Filter Scope (and some variations obviously trying to get it to work):
Objecttype = Company AND "ShowForOrganisation" LIKE ${customfield_10002.name}

But it says 'please enter a valid query'.

If i enter the 2nd part in the Issue Filter Scope, so
Filter Scope: Objecttype = Company
Filter Issue Scope: ShowForOrganisation LIKE ${customfield_10002.label} (also tried .name)

 

then it does not give this error, but the field shows all values so doesn't appear to take the customfield value into account.

Like Andrea Ortiz Gonzalez likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events