JQL for searching value of one field equals value of another field

We need to run a search via JQL that will allow us to find issues where the value of the assignee field is equal to the value of the developer field. Obviously assignee = developer doesn't work; it tries to find any issues where the assignee field is set to the word developer. (Developer is a custom field.)

I found this answer which says that ScriptRunner can do it like this:

issuefunction in expression("project = FOO", "assignee = developer")

But a later question with an answer by the same person indicates that the ScriptRunner function will only work if the custom field is a date, datetime or numeric field.

Will the plugin work on a single user picker field, as indicated in the first post? If not, is there any other way to do this? It's something that SQL can do natively, and seems really unusual that Jira would not allow us to do that kind of search with JQL.

1 answer

This widget could not be displayed.

The documentation of the expression function contains a section named conversions which states:

Users

A String containing the user key. This is sufficient as they are just used for equality comparisons

So, I'd say Script Runner supports username equality comparisons.

Call me an idiot, but that sounds like my sample expression above should work. But it gives me an error: 

Token ("=" at 1:10: "=" ) is not allowed

 1:10 is, I'm guessing, first line, 10th position, which is the equals sign.

 

I also tried changing it to a double equals, and got this error:

java.lang.IllegalArgumentException: Unhandled custom field: customfield_11200

 

So I have to assume it's not supported the way you think it is. Note that I'm not trying to create my own JQL functions; I'm just looking to put this directly into a search.

 

WAIT.  "A String containing the user key." Does that mean that I need to search for specific values? Like, issuefunction in expression("project = PH", "assignee == estrom")? That's exactly what I said I'm NOT trying to do. I don't KNOW the user names. What I'm trying to do is find ANY ticket where the person in the assignee field, whoever they are, is also the person in the developer field. 

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted 12 hours ago in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

39 views 1 0
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you