Forums

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

AQL - Chained References Similar to JOINing in SQL

Brandon Koch
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 13, 2023

Hello,

This is a little complex so please bare with me while I attempt to describe what I'm trying to do.

I have 3 ObjectTypes in Assets.

Employees
JSM Agent Groups
Services Catalog

These ObjectTypes have the following reference structure:

Employees (Has Outbound reference with cardinality of 1 that goes to) =>
JSM Agent Groups (Has an Inbound reference with cardinality 0 or more from) =>
Services Catalog

employees.pngjsm agent groups.pngservices catalog.png
These references allow for the mapping of users to applications in the Services Catalog.
The Employees ObjectType also has a reference to a jira user account.
My goal is to write an AQL query that uses currentUser() to produce a list of all the applications from the Services Catalog that are mapped to the currentUser()'s Employees Object.

I was able to create an AQL query to get an Employee's JSM Agent Group:
objectType IN ("JSM Agent Groups") AND object HAVING inboundReferences((objectType = Employees AND "JIRA User" = currentUser()), referenceType IN ("LAN Group"))

I was also able to create an AQL query to get applications from the Services Catalog ObjectType with outbound references to JSM Agent Groups:
objectType IN ("Services Catalog") AND object HAVING outboundReferences(objectType = "JSM Agent Groups", referenceType IN ("Used By"))

Where I'm stuck now is how to combined these these two queries into one in order to get a list of applications from the Services Catalog that are mapped to a specific user.

Any help or guidance would greatly appreciated. I'm hoping to avoid creating redundant references directly between the Employees and "Services Catalog" ObjectTypes if at all possible.

Thanks!

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
5.4.2
TAGS
AUG Leaders

Atlassian Community Events