I currently am using Scriptrunner's provided script for separation of duties found here: https://docs.adaptavist.com/sr4js/latest/features/workflows/conditions/built-in-conditions/simple-scripted-condition (script below).
The problem is that this script uses status where I want to use a transition. I tried changing it from status to transition in the script and while the script didn't give an error, it didn't work either. My end goal is a workflow condition that will not show the transition to the current user if a specific previous transition was used by that user. That way the person doing the work can't also approve the work.
The original script is:
importcom.atlassian.jira.component.ComponentAccessor
def
changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def
currentUserKey = ComponentAccessor.getJiraAuthenticationContext().getUser()?.key
// returns true if there are no transitions to the target state by the current user
!changeHistoryManager.getAllChangeItems(issue).find {
it.field == "status" &&
currentUserKey == it.userKey &&
"Resolved" in it.toValues.values()
}
The answer, in case anyone else has this use case, is to check for the "from" status as well as the "to" status, like this:
it.field == "status" &&
currentUserKey == it.userKey &&
"In Progress" in it.fromValues.values() &&
"Resolved" in it.toValues.values()
In this example, it's checking for any transition from "in progress" to "resolved".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.