Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

jql function currentAssignee

Martin Buchleitner May 5, 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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
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
Nadir MEZIANI
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 2013

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.

0 votes
darylchuah
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 5, 2013

Hi Martin

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

Hope it helps!

Cheers :)

Martin Buchleitner May 5, 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
Martin Buchleitner May 5, 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
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 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 5, 2013

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

Martin Buchleitner May 5, 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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 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
C_ Faysal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 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...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events