Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the transition name in Jira using groovy

Vineela Durbha
Contributor
February 12, 2019

My code is  as below

WorkflowManager workflowManager = ComponentAccessor.getWorkflowManager();

JiraWorkflow workflow = workflowManager.getWorkflow(issue);
String workflowName=workflow.getName();
log.debug("workflow name" +workflowName)

def wfd = workflow.getDescriptor()
def actionName = wfd.getAction(transientVars["actionId"] as int).getName()
log.debug("Current action name: $actionName")

 

I am getting error as below

groovy.lang.MissingPropertyException: No such property: transientVars for class: 

1 answer

1 accepted

1 vote
Answer accepted
Fazila Ashraf
Community Champion
February 12, 2019

Hi @Vineela Durbha

You are looking to get possible transitions available for the issue?

 

WorkflowManager workflowManager = ComponentAccessor.getWorkflowManager();
JiraWorkflow workflow = workflowManager.getWorkflow(issue);
workflow.getLinkedStep(issue.getStatus()).getActions();

 

See https://community.atlassian.com/t5/Jira-questions/How-Do-I-Get-Available-Transitions-for-Current-Point-in-Workflow/qaq-p/793526

Vineela Durbha
Contributor
February 12, 2019

Hi @Fazila Ashraf

Thanks for your suggestion.

This is returning an Array, Can you help me in extracting the individual status from this array.

 

I am trying as below but it is throwing an exception

List oActions = oStep.getActions().iterator();
log.debug(oActions)
int actionID=0
while(oActions.hasNext())
{
log.debug("inside while")
action=(ActionDescriptor)oActions.next()
log.debug(action.getName())
if(action.getName()=="Auto-create Release")
actionId=action.getId()
log.debug("action id" +actionId)
}

Vineela Durbha
Contributor
February 12, 2019

Never mind I got my solution.

Thanks for your help

Suggest an answer

Log in or Sign up to answer