I am trying to get Workflow Steps using this documentation:
https://scriptrunner.adaptavist.com/latest/jira/recipes/workflow/get-workflow-vars.html
However, when I try to run the code from documentation in Scriptconsole, then I see an error:
import com.atlassian.jira.component.ComponentAccessor
def workflow = ComponentAccessor.getWorkflowManager().getWorkflow(issue)
def wfd = workflow.getDescriptor()
def actionName = wfd.getAction(transientVars["actionId"] as int).getName()
log.debug("Current action name: $actionName")
The errors says:
groovy.lang.MissingPropertyException: No such property: transientVars for class: Script3135
at Script3135.run(Script3135.groovy:18)
How can I declare or get a variable transientVars["actionId"] ?
Hello @zaharovvv_suek_ru
transientVars populated only during workflow transition, so there is no method to retrieve it in script console.
In script console you can get id from ActionDescriptor
See my answer in this quiestion
https://community.atlassian.com/t5/Jira-questions/How-to-get-allowable-transitions/qaq-p/815456
Hope it help!
But if you need just for test, you may declare actionId as it is in your workflow configuration.
int actionId = 12
where 12 is transition number in your workflow
@Mark Markov I've similar query, I was trying to fetch the clone action with a post function.
could you please help on with below code ?
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.workflow.JiraWorkflow
import com.opensymphony.workflow.loader.ActionDescriptor
import com.opensymphony.workflow.loader.StepDescriptor
int actionId = 201
def workflow = ComponentAccessor.getWorkflowManager().getWorkflow(issue)
def wfd = workflow.getDescriptor()
def actionNme = wfd.getAction(actionId)
log.debug(actionNme)
def actionName = wfd.getAction(transientVars[actionId] as int).getName()
log.debug("Current action name: $actionName")
error :
groovy.lang.MissingMethodException: No signature of method: com.innovalog.groovy.AugmentedLogger.debug() is applicable for argument types: (com.opensymphony.workflow.loader.ActionDescriptor) values: [Committed] Possible solutions: debug(java.lang.String), debug(java.lang.String, [Ljava.lang.Object;), debug(java.lang.String, java.lang.Object), debug(java.lang.String, java.lang.Throwable), debug(org.slf4j.Marker, java.lang.String), debug(java.lang.String, java.lang.Object, java.lang.Object)
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58) org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49) org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) script1550236078869870427828.run(script1550236078869870427828.groovy:18)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Krishnakumar Parameswaran
As i can see youre using JMWE addon. JMWE have custom logger that accept only strings, so you must convert ActionDescriptor to string, like this:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.workflow.JiraWorkflow
import com.opensymphony.workflow.loader.ActionDescriptor
import com.opensymphony.workflow.loader.StepDescriptor
int actionId = 201
def workflow = ComponentAccessor.getWorkflowManager().getWorkflow(issue)
def wfd = workflow.getDescriptor()
def actionNme = wfd.getAction(actionId)
log.debug(actionNme.toString())
def actionName = wfd.getAction(transientVars[actionId] as int).getName()
log.debug("Current action name: $actionName")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.