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

Howto get next status within postfunction

Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 1, 2013

Hi,

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

Tuncay

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 1, 2013

Hi,

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();


1 vote
James Taylor September 15, 2013

I think you may just need to move your script down the order, so it fires after the transition has happened. Check the list of Post Functions for the transition in the workflow editor.

1 vote
RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 1, 2013

is this what you are looking?

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

check this

https://answers.atlassian.com/questions/123793/when-transitioning-an-issue-how-can-you-get-the-target-status

1 vote
RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 1, 2013

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

Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 1, 2013

Hi Rambanam,

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.

Thanks again

Tuncay

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events