Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
JIRA process approval. MyGroovy + Custom select. All process in 1 workflow status.
import com.atlassian.jira.component.ComponentAccessor
import groovy.json.JsonSlurper
cfStep = ComponentAccessor.customFieldManager.getCustomFieldObject(10003)//Text Field (single line)
cfCustomSelect = ComponentAccessor.customFieldManager.getCustomFieldObject(10004)//Custom Select List
def customSelectValue = issue.getCustomFieldValue(cfCustomSelect)
def processApproval = parseText(customSelectValue.getData())
def currentStepName = issue.getCustomFieldValue(cfStep)
def currentStep
currentStep = processApproval.steps.find{ == currentStepName}
} else {
return false
def nextStep = getNextStep(currentStep, processApproval)
return false
return true
def getNextStep(currentStep, processApproval){
int indexCurrentStep = processApproval.steps.lastIndexOf(currentStep)
int nextIndex = indexCurrentStep + 1
if(nextIndex >= processApproval.steps.size()){
return null
} else {
return processApproval.steps.get(nextIndex)
def parseText(text) {
def jsonSlurper = new JsonSlurper()
return jsonSlurper.parseText(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.