Fast-track transition an issue based on assignee's Role

Kathleen Jacobs June 10, 2013

Using Script Runner Fast-track transition an issue, how can i have it so it changes the status based on the Asignee's role.

Example:

Rob is in QA, Mike is a PM

Issue is assigned to Rob when created, so the issue is set to status QA

2 answers

1 accepted

1 vote
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.
June 11, 2013

You could this script to test the assignee role.

import com.atlassian.jira.security.roles.ProjectRoleActors
import com.atlassian.jira.security.roles.ProjectRoleManager

String role = 'QA'

ProjectRoleManager projectRoleManager = componentManager.getComponentInstanceOfType(ProjectRoleManager.class)
ProjectRoleActors projectRoleActors = projectRoleManager.getProjectRoleActors(projectRoleManager.getProjectRole(role), issue.getProjectObject())
projectRoleActors.getUsers().contains(issue.assignee)

Henning

Kathleen Jacobs June 12, 2013

How would I use this with the Fast Track Transition?

Pretty much, where would I put the script within the workflow?

Would I create a custom script with Fast Track and this one meged?

Or is there some way I can connect the two?

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.
June 10, 2013

You can use one of the provided links beneath the condition field which populates the condition with

isUserMemberOfRole('Administrators')

to restrict the fast track to specific roles.

Henning

Kathleen Jacobs June 10, 2013

But is that referring to the assignee or the user at the time of the transition?

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.
June 11, 2013

It the current user who is executing the transition, not the assignee.

Kathleen Jacobs June 11, 2013

Trying to find a way to it's the assignee. Not the current user.

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.
June 11, 2013

Ah, sorry. Should've read the question. :-)

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 11, 2013

You seem to have two different conditions here. You can use both, combined with an AND or and OR, but it's worth being clear.

Henning's use of isUserMemberOf does answer your original question, - it will let people in the role of Administrator to run your "fast track" transition. If I were to log in as an ordinary project user, then I simply would not see the "fast track" and I couldn't run it.

The assignee is a separate condition. You can add that in a second condition on the transition to make the logic say "Fast track can only be done by admins, OR the current assignee". Or, you could make it say "the user must be the assignee AND they must be an admin".

In all cases, Jira looks at the person logged in to match them against those conditions (it's nonsense to do it any other way)

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.
June 11, 2013

Fast Track Transition is a postfunction in Script Runner to execute another transition after a transition triggered by a user. The condition is the condition under which the transition is triggered and IMO it's ok to restrict the trigger on the role of the assignee.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 11, 2013

Ah, thanks Henning, I've not used that one before, so didn't think of it.

Suggest an answer

Log in or Sign up to answer