Within a postfunction, I need to get both before and after status objects.
When I call issue.getStatusObject(), it gives me the current status object. However I also need the upcoming status object.
Is there a way to get this next status object?
Thanks in advance
This is the exact code getting before and after steps
List<SimpleStep> currentSteps = (ArrayList<SimpleStep>)transientVars.get("currentSteps"); SimpleStep simpleStep = currentSteps.get(0); int actionId = simpleStep.getActionId(); int beforeStepId = simpleStep.getStepId(); ActionDescriptor ad = workflow.getDescriptor().getAction(actionId); int afterStep = ad.getUnconditionalResult().getStep();
you can get availble actions like this
IssueWorkflowManager issueWorkflowManager = ComponentAccessor .getComponentOfType(IssueWorkflowManager.class); Collection<ActionDescriptor> actions = issueWorkflowManager .getAvailableActions(issue);
if my guess is correct, you are trying to auto transition issue to next state, if it is correct then i don't think it will work by using post function yu have to do it by using listener.
loads of discussions had in this forum just search like auto transition you will find lot of posts
Thanks for your answer. However I am not looking for auto transition.
All I need is just the state info.
For example, in "Start Progress" transition, the issue's status changes from "Open" to "In progress". In the post function, I need "In Progress" status object in order to calculate something.
is this what you are looking?
def stepId = action.getUnconditionalResult()?.step getWorkflowDescriptor().getStep(stepId)
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...
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