Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

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

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")




2 answers

1 accepted

2 votes
Answer accepted

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 Sep 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.

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

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you