jql function currentAssignee

I need to setup a filter, where the jql is something like:

developer = currentAssignee()

I was not able to find any plugin which contains such a jql function

6 answers

1 accepted

2 votes
Accepted answer
Henning Tietgens Community Champion May 05, 2013

Regarding your problem you could write a listener using Script Runner plugin which detects changes of the aforementioned custom fields and changes the assignee respectivly. See https://jamieechlin.atlassian.net/wiki/display/GRV/Listeners on how to implement a listener.

You could implement a general test if the assignee matches the custom field content (regarding the current situation of the issue) or you can directly look into the event to see, if one of the customfields were changed (e.g. event?.changeLog?.getRelated('ChildChangeItem')?.any{ it.field=='assignee' } to see if the assignee was changed, customfields should work similar).

Henning

I got the logic ( status depending custom field ) running using the script console, but when i try a groovy listener - i get an exception:

java.lang.RuntimeException: No such property: Status for class: com.atlassian.jira.issue.IssueImpl

And that occures on this class:

import com.atlassian.jira.event.issue.AbstractIssueEventListener
import com.atlassian.jira.event.issue.IssueEvent

class AssigneeUpdateListener extends AbstractIssueEventListener {  
 @Override void workflowEvent(IssueEvent event) {
 }
}

Henning Tietgens Community Champion May 16, 2013

You get the status name like this

issue?.statusObject?.name

I am not getting the status at this time - the definition of the listener is empty. So i do not understand why the exception occures in the jira log files :(

Henning Tietgens Community Champion May 20, 2013

Mmh, I don't think that the above code is responsible for the error. How do you integrate the script into JIRA? Is the error still there if you remove the integration? Could you paste the complete stacktrace of the error?

Well it seems that the groovy is now working correct... i packed the same code also in a jql function to verify the listener..

Thanks for your help !

hi martin,

JQL is "Jira Query Language"

what exactly are you looking for?

afaik plugins can use/access this type of search as well...

0 votes
Henning Tietgens Community Champion May 05, 2013

If "developer" is a group in your JIRA system you could write

assignee in membersOf("Developers")

If it's a role there is no such function out of the box. Maybe you can use the Script Runner plugin and write your own JQL function for this.

Henning

the previous user and the new selected user are both membersOf("Developers")

Yes that's my problem - and edit's can not be "catched" to update / define some functions on it.

This Setup is mainly because our users are used to work this way and they do not want to change it :(

Henning Tietgens Community Champion May 05, 2013

Ok, now with your comment this doesn't help you. If I understand correctly, the custom fields are user picker custom fields, correct? And you want to update the assignee if one of these customfields are changed?

well because of the required setup we have 4 custom user picker fields which are filled by role definitions: CB, Development, Integration, Verification

Those 4 custom fields are used to set the assignee within the workflow ( depending on the current action in a post-function ) . If somebody changes the selected user of e.g. Development the assignee is not udpated to the selected value. the previously chosen user is still the assignee.

Now i tried a workaround of problem using a Jelly Service and a filter like this one

state in ( "in development", "product test" ) and development != currentAssignee()

The Jelly Service should call this filter and update the current assignee to the user defined in the custom field "development".

But a function like this does not exist. I already wrote a custom plugin, but not for jql ...

0 votes
Daryl Chuah Atlassian Team May 05, 2013

Hi Martin

You can try using JQL Tricks plugins that provides basic to complicated JQL functions.

Hope it helps!

Cheers :)

I already got to this plugin, but imho it does not meet my (current) requirements :(

But it provides cool new jql functions :)

Hi,

You can add a custom field "User Picker" and you initialize it when the developer do some changes on issue; and the User Picker = current Assignee() will work.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,653 views 18 21
Read article

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