Hi,
I have the exact same case as below:
"Sometimes you want different people from the same group or role to execute different steps of the workflow. For example, the person that resolved an issue should not be the same person that validates the fix.
You can put the following code as a condition on the Validate action, which will prevent the same user that did the Resolve action from validation:"
also in the link (https://scriptrunner.adaptavist.com/5.5.5/jira/recipes/workflow/conditions/simple-scripted-condition.html)
The code provided for this case in the link by Adaptavist ScripRunner is
import com.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()
}
Unfortunately it is not working as it should be.
Could someone please help.
Thanks in advance.