Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Unable to retrieve objects through lookupObjects when referencing reporter of issue

Hielko Manders October 25, 2023

Hi all,

 

I am trying to retrieve a list of all objects associated with an employee through AQL.

 

Employee is an object in my object schema which has multiple properties such as Name and User (object).

Statement below works and retrieves all the objects

object HAVING outboundReferences(objectType = "Employees" and Name = "John Doe")


I have tried several options to make this generic but none of them seem to work

object HAVING outboundReferences(objectType = "Employees" and Name =  ${reporter.displayName})

object HAVING outboundReferences(objectType = "Employees" and User =  currentReporter())

 

What am I doing wrong? Any suggestions?

 

Thank you!

 

 

1 answer

1 accepted

0 votes
Answer accepted
Marc - Devoteam
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.
October 25, 2023

Hi @Hielko Manders 

Welcome to the community.

With AQL you are referencing Assets in a scheme, this relates to the information in the scheme.

Within in AQL you can't use JQL (If I remember correct).

There are options to use user references in JQL, but the object used in AQL needs to have a attribute in the object of the type user.

See also AQL documentation

Hielko Manders October 25, 2023

Employee asset.JPG

Hi Marc,

 

As you can see I have an attribute of type user in my schema but when I use currentReporter(), which can be used in AQL the query still doesn't return any objects.

 

Regards,

Hielko

Marc - Devoteam
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.
October 25, 2023

Hi @Hielko Manders 

What is the value set to the attribute in the object?

To use current user, you have to specified in the object as the user.

Hielko Manders October 25, 2023

Hi @Marc - Devoteam 

It is a Jira account.

Marc - Devoteam
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.
October 25, 2023

Hi @Hielko Manders 

I get this, but is there one account mentioned, is this yours or another account.

This function will only work when an issue is selected, and refers to the reporter that appears in the current issue.

Hielko Manders October 25, 2023

@Marc - Devoteam 

 

The use case is "Offboarding employee". When an issue is created where request type is "Offboard employee" I want to create tickets for HR, IT etc in order to revoke access to IT systems, return assets such as laptops. 

I am trying to get it working by referencing the Reporter of the issue but that somehow doesn't work.

I also tried to ad a custom field Employee and tried to reference that field through $object HAVING outboundReferences(objectType = "Employees" and Name = ${customField_10211.name})

 

Does this make sense? 

Marc - Devoteam
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.
October 25, 2023

Hi @Hielko Manders 

I think you need to get Automation in the loop.

Where you need to probably create a variable that stores the name of the reporter or use the custom field you created

Then see if you can make a lookup action to find the right employee based on the variable created or the custom field that you have created

Would that be something to investigate

Hielko Manders October 25, 2023

@Marc - Devoteam 

I will give it a try.

Like Marc - Devoteam likes this
Hielko Manders October 26, 2023

@Marc - Devoteam issue solved! In the end it was extremely simple.

Not working

object HAVING outboundReferences(objectType = "Employees" and Name = {{Employee.Name}})

Working

object HAVING outboundReferences(objectType = "Employees" and Name = "{{Employee.Name}}")

The property should be surrounded by double quotes. The thing that throws you off is that if you use this syntax the Validate syntax button isn't enabled so you think the syntax is not correct.

 

Thanks for the help,

 

Hielko

Like Marc - Devoteam likes this

Suggest an answer

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

Atlassian Community Events