In our Orig we are trying to avoid formal roles like DEV and QA. Is it possible to use Scriptrunner to control transitions between statuses, and prevent the same person from moving an ISSUE between all statuses.
For example, I want DEV A to move a STORY to RESOLVED, but not the next state of VALIDATED, which he must ask DEV B to do after checking his work. In another ISSUE though DEV B may move the ISSUE to RESOLVED, and DEV A QA's the work moving it to VALIDATED.
Ideally, it's a very simply JQL query to determine who moved the ISSUE to one RESOLVED and prevent that same user from moving it to VALIDATED too.
(I know we can do this by assigning users to static roles then only allowing users in a role to perform the transition – this isn't what I want to manage)
You could put the following code as a simple scripted condition on the Validate action:
import com.atlassian.jira.component.ComponentAccessor def changeHistoryManager = ComponentAccessor.getChangeHistoryManager() def changeHistories = changeHistoryManager.getChangeHistories(issue) def currentUserKey = ComponentAccessor.getJiraAuthenticationContext().getUser()?.key // returns true if there are no transitions to the target state by the current user passesCondition = ! changeHistoryManager.getAllChangeItems(issue).find { it.field == "status" && currentUserKey == it.userKey && "Resolved" in it.toValues.values() }
You may have already seen this, but in a Workflow's Transition's Condition you can select one of these, such as "Only Reporter Condition" so that only allow the reporter to execute this next transition (ex: if your DEV A wrote a Task and DEV B worked on it, only DEV A can set the next workflow transition to say Completed once they review it).
Add Condition To Transition | |||||||||||||||||||||||||||||||||||||||||||||||||||
|
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can add a "separation of duties" condition to the transition of the workflow. This is built in and should get you what you are looking for.
Hope this helps.
Cheers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.