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!
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
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.