Hi,
First off I am using ScriptRunner.
I am trying to write a generic, simple script (ie: return true/false) to be used by multiple transitions .
These will be used to set up a condition for the transition (ie: the transition will be visible or invisible based on the result).
The goal is to check if the action will lead to a particular step.
Pseudo code:
return transition.endStep == "ABC"
The issue is I cannot (after hours of reading) find a way to access the transition the condition script is being run for. I am able to get the current step descriptor as follows:
def currendef issueManager = ComponentAccessor.getIssueManager()
MutableIssue curIssue = (issueManager.getIssueByCurrentKey(issue.getKey()))
StepDescriptor = workflow.getLinkedStep(curIssue.getStatus())
transientVars["actionId"] is not available... (https://scriptrunner.adaptavist.com/latest/jira/recipes/workflow/get-workflow-vars.html)
getDestinationStep() is not available... (https://scriptrunner.adaptavist.com/latest/jira/behaviours-api-quickref.html#_workflow_information)
Thanks for any guidance!
Jon
Where are you pointing to your generic script?
If you put it in a "custom script condition", transientVars["actionId"] should be available.
It's not available in "simple scripted condition".
Then you can get the name of the target status:
ComponentAccessor.getWorkflowManager().getWorkflow(issue).getDescriptor().getAction(transientVars['actionId'].toInteger()).unconditionalResult.status
Hi,
I was trying it in a simple scripted condition...
"It's not available in "simple scripted condition"." This is all I needed!
Maybe I missed it somewhere in the documentation.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think this is listed in the documentation, but the script editor's script info (the question mark icon) is your friend when it comes to understanding what variables are available
If it's not listed, it is not available.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.