I have this code (JIRA Server 8.6):
if (state && state != "")
{
//Find "State" Action from here
JiraWorkflow workFlow = ComponentAccessor.getWorkflowManager().getWorkflow(mIssue)
def status = mIssue.getStatusObject()
StepDescriptor currentStep = workFlow.getLinkedStep(status)
log.info "Script=" + scriptName + " ScriptRunIdent=" + scriptRunIdent + " Message='Current Step: " + currentStep.getName() + " found.'"
List<ActionDescriptor> actions = currentStep.getActions()
log.info "Script=" + scriptName + " ScriptRunIdent=" + scriptRunIdent + " Message='Action: " + actions.size() + " found.'"
for (Iterator<ActionDescriptor> iter = actions.iterator(); iter.hasNext();)
{
ActionDescriptor actionDescriptor = (ActionDescriptor) iter.next()
log.info "Script=" + scriptName + " ScriptRunIdent=" + scriptRunIdent + " Message='Action: " + actionDescriptor.getName() + " found.'"
if (actionDescriptor.getName().toLowerCase() == state.toLowerCase())
{
actionId = actionDescriptor.getId()
log.info "Script=" + scriptName + " ScriptRunIdent=" + scriptRunIdent + " Message='Found ActionDescriptorId: " + actionDescriptor.getId() + "'"
}
}
and it returns 0 actions.... I have no clue why... permissions are in order and Im 99,999% sure it has been working.
The log part:
Current Step: To Do found.
is correct, so I have a handle to the correct Step.
Log is:
020-03-27 12:03:23,663+0000 http-nio-8080-exec-1 INFO servicenowautomation 723x164703x1 1gekzbz 10.237.193.165,127.0.0.1 /rest/scriptrunner/latest/custom/updateincident [c.o.scriptrunner.runner.AbstractScriptRunner] Script=updateincident.groovy ScriptRunIdent=53501 Action=Start
2020-03-27 12:03:23,664+0000 http-nio-8080-exec-1 INFO servicenowautomation 723x164703x1 1gekzbz 10.237.193.165,127.0.0.1 /rest/scriptrunner/latest/custom/updateincident [c.o.scriptrunner.runner.AbstractScriptRunner] Script=updateincident.groovy ScriptRunIdent=53501 Message='Issue: AL-100 found.'
2020-03-27 12:03:23,665+0000 http-nio-8080-exec-1 INFO servicenowautomation 723x164703x1 1gekzbz 10.237.193.165,127.0.0.1 /rest/scriptrunner/latest/custom/updateincident [c.o.scriptrunner.runner.AbstractScriptRunner] Script=updateincident.groovy ScriptRunIdent=53501 Message='Current Step: To Do found.'
2020-03-27 12:03:23,665+0000 http-nio-8080-exec-1 INFO servicenowautomation 723x164703x1 1gekzbz 10.237.193.165,127.0.0.1 /rest/scriptrunner/latest/custom/updateincident [c.o.scriptrunner.runner.AbstractScriptRunner] Script=updateincident.groovy ScriptRunIdent=53501 Message='Action: 0 found.'
2020-03-27 12:03:23,665+0000 http-nio-8080-exec-1 INFO servicenowautomation 723x164703x1 1gekzbz 10.237.193.165,127.0.0.1 /rest/scriptrunner/latest/custom/updateincident [c.o.scriptrunner.runner.AbstractScriptRunner] Script=updateincident.groovy ScriptRunIdent=53501 Error='Transition: Done could not be found.'