Missed Team ’24? Catch up on announcements here.

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

How can I Query all tickets in Jira where Reporter Approved all their own tickets?

Ian Johnsen March 8, 2019

How can I Query all tickets in Jira where Reporter Approved all their own tickets?

We have the Script Runner Add On.

 

Works: Reporter AND Approver = ijohnsen

reporter = ijohnsen AND Approvals = approver(ijohnsen)

 

Works: Assignee = Reporter

issueFunction in expression("", "assignee == reporter")

 

This is what we need:

Does not work: Approver = Reporter

issueFunction in expression("", "(Approvals = approver(ijohnsen)) == reporter")

 

What am I doing wrong?

Thanks!

1 answer

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 13, 2019

It's not that you're doing something wrong per se.  The way that this approvers field is being used in Jira Service Desk means that this specific field is being used differently than the other user fields like reporter or assignee are in Jira.   You can see this in Jira's native JQL if you try to search by the approvers field directly with a JQL such as

Approvers = username

In my Jira site this generates an error of

Field 'Approvers' is not searchable, it is only sortable.

We can see from this error that this specific approvers field is a special field created by service desk.  As such it appears that it is not intended to be searched on directly.   The way you're trying to search this is also trying to call the approvals custom field and use a custom search function to then find user data that relates to that custom field.  But since we can't actually search that approvers field directly, it's not possible to make the comparison that Scriptrunner's scripted JQL functions is trying to do.

That said, I did find an alternative approach that might be helpful here in the future. Instead of using the default approvers field, it could be possible for you to create your own custom field of type user picker field and then search against that field.  More details about this approach are explained in

https://community.atlassian.com/t5/Jira-Service-Desk-questions/Query-for-service-request-without-approvers/qaq-p/803211

The problem in that thread is slightly different from yours, but I think that these steps could help you to ultimately be able to search against the user approving requests, as well as then using scriptrunner's additional functions to compare that user field against other user fields.   Granted this won't help you find that data in your current system.  I am not certain there is a good solution to find this current data. But if you make this kind of change you could then be able to find this kind of info in the future.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events