Transition condition on specific user

Martin Hanus April 26, 2017

Hi guys,

I was wondering whether it's possible to setup JIRA workflow in such way, that only specific user can change status of an issue. Basically, I would like to create transition condition like current_user == 'jira_robot'. I seem to be unable to get current user using custom condition script. 

 

Thanks

Martin

2 answers

1 accepted

1 vote
Answer accepted
Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 26, 2017

Hi Martin,

you are right, there is no "user = abc" condition. But there is a condition "User is in Group", so an easy way is to create a group and add the user to this group and add the "User is in Group"-condition to the transition.

Martin Hanus April 26, 2017

Yep, I know about this. But it's sort of a workaround. I was hoping there's a 'clean' way how to do this. But thank you for suggestion, I'll probably go with this solution.

 

Btw, Isn't there a way how to bypass this using ScriptRunner plugin which we are actually using?

Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 26, 2017

Yes, this should be possible. There is an example here: 

https://scriptrunner.adaptavist.com/4.3.0/jira/recipes/workflow/conditions/current-user-equal-to-cf.html

You get the currentUser as described in the example and compare that value not to "sponsor.name" as stated in the example but with your own string.

 

Like Pierre BF likes this
Deleted user October 11, 2018

Is it possible to set a condition only to a specific group? 

Let's say I have many groups and one of them is 'abc'. I like apply the 'Previous Status Condition' condition only to this 'abc' group and not to other groups. 

Can I do it?  

1 vote
Manuel November 19, 2018

If someone is searching for the solution. You can use this code (jsut change USERNAME to the value that should be compared)

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.opensymphony.workflow.WorkflowContext
def TransitionUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() as ApplicationUser
passesCondition = TransitionUser.name == "USERNAME"

Suggest an answer

Log in or Sign up to answer