How to count the number of assets in a Assets Object field

Chris Melville
Contributor
August 15, 2024

I'm looking for a way to count the number of assets in an Asset Object reference custom field.   Since this is to be used in a Jira issue gadget in Confluence, it needs to be available via JQL.

I have an assets custom field "Affects Platform" and I need to be able to query for all issues that have at least 2 objects in that field.  Something like the snippet below but of course this finds issues with any number of objects in the field.

"Affects Platform" in aqlFunction("objecttype = Platform") 

2 answers

0 votes
Chris Melville
Contributor
August 15, 2024

Thanks Adolfo, I agree that would work.  I prefer not to create yet another custom field if I can avoid it but if there really is no other option I may take this approach.  I will wait a bit to see if there are any clever answers that don't require that.

0 votes
Adolfo Casari
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.
August 15, 2024

@Chris Melville  You should create a number customfield and have an automation rule that parses "Affects Platafform" customfield to check how many objects it has and then put that value in your customfield.

Then you can use that customfield in JQL (.e. "customfield name" >= 2)

Suggest an answer

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

Atlassian Community Events