You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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.