Scriptrunner Behaviour trigger based on workflow transition/step?

Is it appropriate for a scriptrunner Behaviour script to update field menu items based on workflow transition/step?

4 answers

1 accepted

This widget could not be displayed.

Its fine to use them in behaviours and ScriptRunner provides methods which allow you to get this information easily.

To access action name in behaviours you can use:

def transitionName = getActionName()

 

To access workflow related information in behaviours you can use the following methods:

Workflow Information
getActionName() Returns the name of the current action if the issue is undergoing a workflow action, null otherwise.
getAction() Returns an ActionDescriptor object if the issue is undergoing a workflow action, null for EditAssign, etc.
getDestinationStepName() Returns the name of the destination step if the issue is undergoing a workflow action, null otherwise.
getDestinationStep() Returns an StepDescriptor object for the destination step if the issue is undergoing a workflow action.

You should see these methods at the bottom when editing the behaviours script.

Thanks Mark.  That was easy.

This widget could not be displayed.

It's not clear what you mean. 

This widget could not be displayed.

If you mean field options, I don't see why not

This widget could not be displayed.

I added the following code snippet which I have been successfully using in to condition groovy scripts:

    ComponentManager componentManager = ComponentManager.getInstance()
    JiraWorkflow workflow = componentManager.getWorkflowManager().getWorkflow(issue);
    transitionName = workflow.getDescriptor().getAction(transientVars["actionId"]).getName()

but the transientVars map does not exist and I'm unaware of how to create it.
Can I get the transitionName without using transientVars?

Help?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

504 views 3 18
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you