How can i allow only to creator to make the transition?

Haris Becic November 3, 2016

Hi all,

i would to know is it possible to select that only the creator of an issue can make some specific transition. We have 3 fields Assignee, Reporter and Creator of an issue. I want to restrict that only creator can make the transition. Is there any way to do that? I also tried with Groovy script but i don´t understand this groovy scripting. 

Thanks 

3 answers

0 votes
Katya Wegner November 6, 2016

Hi,

it is possible without using Script Runner. When you change your workflow, you can define conditions for a transition. So go to the transition, click on conditions and add a new one. There is already the "Condition Only Creator" predefined. (Not sure what the exact wording is in english, my JIRA is in german wink).

That's the way, it works for us, and it works fine.

Regards.

0 votes
Haris Becic November 3, 2016

Hi Thanos,

i saw that i need to import some managers at the begin of the script. I don´t understand which Managers should i import. Should i only add this lines to the Groovy field or?

Thanks

 

Thanos Batagiannis _Adaptavist_
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.
November 3, 2016

Is this a script runner Fast-track transition an issue ? If that is the case then you do not want to import anything in the Condition field. 

Haris Becic November 3, 2016

For example:

  1. State = Analyzing
  2. State= Implemented

    Between this two states there is a transition with the name "Analysis done". I want now that only the "Issue Creator" this "Analysis done" transition can do (only the person who created the issue can make this "Analysis done" transition)

Thanks

Thanos Batagiannis _Adaptavist_
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.
November 3, 2016

Haris,

do you use the ScriptRunner plugin ? I cannot answer if i don't know more details (there are more than one plugin that make use of groovy scripts) ... 

Haris Becic November 3, 2016

Sorry smile I am using JIRA Misc Workflow Extension Plugin. With this plugin is also possible to write groovy scripts. 

Thanks

Thanos Batagiannis _Adaptavist_
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.
November 3, 2016

ok then I am not exactly sure about the syntax but should be something like 

import com.atlassian.jira.component.ComponentAccessor

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
return currentUser == issue.get("creator")
0 votes
Thanos Batagiannis _Adaptavist_
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.
November 3, 2016

Hi Harris,

If you use script runner for your script then your condition should be 

currentUser == issue.creator

or else I suppose you can get the caller, something like 

def caller = transientVars.get("context").getCaller()
return caller == issue.creator.key

regards, Thanos

Haris Becic November 3, 2016

Hi Thanos,

i saw that i need to import some managers at the begin of the script. I don´t understand which Managers should i import. Should i only add this lines to the Groovy field or?

Thanks

Suggest an answer

Log in or Sign up to answer