It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

jql function currentAssignee

Martin Buchleitner May 05, 2013

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
Answer accepted
Henning Tietgens 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

Martin Buchleitner May 16, 2013

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 May 16, 2013

You get the status name like this

issue?.statusObject?.name

Martin Buchleitner May 20, 2013

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 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?

Martin Buchleitner May 20, 2013

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 !

0 votes
C. Faysal May 05, 2013

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

Martin Buchleitner May 05, 2013

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

Martin Buchleitner May 05, 2013

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 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?

0 votes
Martin Buchleitner May 05, 2013

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

Martin Buchleitner May 05, 2013

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

But it provides cool new jql functions :)

0 votes

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Next-gen

Introducing subtasks for breaking down work in next-gen projects

Teams break work down in order to help simplify complex tasks. This is often done iteratively, with tasks being broken down into smaller tasks and so on until the work is accurately captured in well-...

6,213 views 22 30
Read article

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