Write a JQL query using a custom field to query values in another field

Kris Konigsfeld June 21, 2021

We have a custom field called "Component Assigned", which is a drop down list that has all the values of Component/s.   I want to write a JQL query that finds all issues where Component/s does NOT have the value in the Component Assigned.

psuedo code: component NOT IN (issue.value."Component Assigned")

 

Thanks!

Kris

2 answers

1 accepted

2 votes
Answer accepted
Kris Konigsfeld March 7, 2022

In Jira Structure, I created a new formula column with this formula:

if SIZE(components) > 0: if components.ANY($.match(ComponentAssigned)): "✅" ELSE : "❌" ELSE: ""

Since components is a required filed, the first test is always true for any real issue.  This produces "" for any lines that come about when you group things, so your only checking the lines with real issues.

0 votes
Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 25, 2021

Hi @Kris Konigsfeld ,

welcome to the Atlassian Community!

I can imagine creating your own JQL function with ScriptRunner, but it doesn't seem right to me.

May I ask you why you have this special custom field in your system? It looks like it is duplicite to Component/s somehow and maybe completely different solution is possible.

Thank you.

Kris Konigsfeld March 7, 2022

Hi @Hana Kučerová , I can't believe that I didn't respond to this earlier.  Thanks for getting back.  I have a custom field because its a single select and you can only select one component.  Its similar to the assignee (which gets filled in typically by the technical lead of the first component/s), but the name space is in component.  This means this functional component is the owner and driver of the issue and if the assignee isn't doing their job, we use component assigned to identify the functional component owner and we know the manager of that component assigned.

But, I did find a way to resolve my problem.  Not with JQL but with structure, views, and formulas.  The formula language is very robust, and I setup a structure column that tests if component assigned is a array member of the component/s array.  If not, I flag it, if so, I leave the column blank.  I sort on the column and all the flag ones show up and I fix them.

Like # people like this

Suggest an answer

Log in or Sign up to answer