Forums

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

AQL/IGL for all top level Object Types in a specific schema

Brian Peters January 24, 2023

This seems like a very basic, fundamental question and I've googled and looked through online doc but am having no luck with this so far. 

I'm writing a groovy script using some classes that access the Insight API written by Peter-Dave Sheehan (which are quite useful, thank you Peter-Dave).  What I need is a list of keys for the object types populated in a given schema. 

I'm fairly new to Insight so my vocabulary may not be exactly correct so I'll try to describe it.  Let's say I have an Insight Object Schema called "Divisions" that defines an Object Type named "Department", each with an attribute named "Office".  We then create 3 Departments and fill out their Office attribute.  The hierarchy might look like this (please forgive my primitive formatting since this text editor tool is limited):

Example Object Schema

  Object Schema: Divisions

                        -----> Object Type: Department

                                                                 ------> Attribute: Office

So, the Divisions object schema contains an object type named Department with an attribute called Office

Example Object Types 

  Object Schema: Divisions

                        -----> Facilities

                                          ------> Office 123

                        -----> Marketing

                                          ------> Office 561

                        -----> Human Resources

                                          ------> Office 35

So, there are 3 Departments (Facilities, Marketing, Human Resources), each with an associated office attribute (Office 123, Office 561, Office35).

I need an IQL/AQL statement that returns a list of all the Department keys that have been added to the Divisions Object Schema (I ultimately be using the result to create JSON for a REST Endpoint) but I can't figure out how. 

Later I will need to grab the attribute values for each of these Departments as well.   

Thanks in advance!     

 

1 answer

0 votes
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 15, 2023

An IQL to return all the Department objects should be quite simple, it's just "objectType = Department".

Running this either in the Assets/Insight Search screen, or in the InsightUtils.findObjects()  method should return 3 objects. 

E.g.

import com.qad.common.jira.utils.InsightUtils

def iql = 'objectType = Department'
def departmentObjects = InsightUtils.findObjects(iql)
def departmentKeys = departmentObjects.collect{it.objectKey}
def departmentOffices = departmentObjects.collect{deptObject ->
InsightUtils.getAttributeValueFromDotNotation(deptObject, 'Office', false)
}

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, team ’25 europe guide, teamwork collection, atlassian events, conference guide, team culture, collaboration tools, ai in teamwork, atlassian learning, event schedule, keynote previews, community events

Must attend events for Team Europe '25!

Make the most of your time in Barcelona with our curated guide – discover how Jira, Confluence, Loom, and Rovo work better together, connect with Atlassian experts, and enter to win an Apple prize bundle!

Get the guide
AUG Leaders

Atlassian Community Events