Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

When transitioning an issue, how can you get the target status

I need this information to write a workflow postfunction.
The issue status itself has not been updated yet.
(a workaround is to move the postfunction after the
'Set issue status to the linked status of the destination workflow step.')

Is there some property somewhere - associated to an action - which details out what the target status is - or target step ?

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
Answer accepted

In the transientVars is the action ID.

From the workflowDescriptor you get an Action object using the action ID, then you have the destination step:

def stepId = action.getUnconditionalResult()?.step
getWorkflowDescriptor().getStep(stepId)

Works perfectly - as always.


Thanks Jamie.

action.getUnconditionalResult() doesn't always return the destination step/status info.  I've seen it where the transition is to say "Review" and it returns status name of "Done"

Mostly you need to use WorkflowService, do a getWorkflow evaluate the steps - http://docs.atlassian.com/software/jira/docs/api/latest/com/atlassian/jira/bc/workflow/WorkflowService.html#getWorkflow(com.atlassian.jira.bc.JiraServiceContext, java.lang.String)

Looks complicated. But can you explain what are you trying to achieve by getting the status name?

We are working on a new plugin, where the actions on the future status are required.
I did some digging and found some solution.

After some digging ...

List<ChangeItemBean> cibs = (List<ChangeItemBean>) transitionVars.get("changeItems");

String targetStatusName = null;
    	
    	// find the destiny transitionname
    	for (ChangeItemBean cib:cibs) {
    		if (cib.getField().equals("status") && cib.getFieldType().equals("jira")) {
    			targetStatusName = cib.getToString();
    		}
    	}
    	
    	if (targetStatusName == null) {
    		log.error("Transition without know target status");
    		return null;
    	}

TAGS
Community showcase
Published in Marketplace Apps & Integrations

Happy New Year and Welcome New Marketplace Partner Program Partners!

Happy New Year! We hope you all had a safe and restful holiday season. 2020 was a unique year full of unforeseen events; however, as we enter the new year of 2021, we’re optimistic for the light at t...

314 views 5 14
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you