I'm trying to hide workflow transitions base on component selection. I created Behaviour script and getting errors. How I can declare a workflow transition? How I can accomplish this?
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.workflow.TransitionOptions
import com.atlassian.jira.bc.project.component.ProjectComponent
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def action = workflowManager.getActionsByName("Done")
def approved = workflowManager.getActionsByName("In Progress")
def components = getFieldById(getFieldChanged()).value as List<ProjectComponent>
if(components.any{it.name == 'Sales'}){
action.setHidden(true)
}
if(components.any{it.name == 'Support'}){
approved.setHidden(true)
}
Thank you
Hi Shah,
while I cannot help with the code itself I'd like to confirm we did something like this in the past using a simple scripted validator:
On the contrary to what you wrote we did not use a Behaviour, though.
We also not aimed towards hiding the transition (condition) but show a error message to the user (validator).
Probably this would be an alternative for you? If so, the above linked documentation should help you to get an idea.
Cheers,
Daniel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.