The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Nested AQL Query?

Monty
Contributor
June 24, 2024

This is specifically related to Jira Service Management and working with Filters. I understand that I can do this with the API or Jira Automation in multiple calls, but my goal is to display the results on a Dashboard, so I need to do this in a single query.

I have two objects Users and Departments.

Let's say that I have the following User Objects:

Name -> Department

Moe -> Team A

Larry -> Team A

Curly -> Team A

 

CurrentUser is Moe.

I can get Moe's department using:

Department IN aqlfunction("objecttype = Departments and object HAVING inR(agent in currentUser())")

This returns the Department Object "Team A".

 

What I want to do is get all members of Moe's Department.

So:

currentUser -> Department -> Users

Moe -> Team A -> Moe, Larry, Curly

Or to put it another way: objecttype = Users and Department = (currentUser.Department)

Is this possible?  Essentially, I am trying to create a filter that shows issues that are assigned to people on the same team.

The way that I have this implemented currently, is that there is a Custom Object Asset Field for Department and I am using the aqlfunction above to show tickets assigned to that department. The problem is that sometimes a ticket needs to be assigned to a Team A, but a member of Team B is the assignee on a ticket (this can happen when a person transitions from one team to another). If we only look at the department, then the dashboard shows all tickets in that department including those assigned to members of another team.

 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Aaron Jurrens
November 26, 2024

I think this will do what you're after:

"Recipient - Reporter" in aqlFunction("objectType = People AND object HAVING outboundReferences(object HAVING inboundReferences(\"Atlassian Account ID\" = currentUser(), referenceType IN (\"Default Team\")), referenceType IN (\"Default Team\"))") 

 This is set to find the department of the current user, but could be more statically configured.

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events