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

Problem in issue status change programmatically (Issue status not updated on view issue page but updated on history)

Sachin Dhamale June 15, 2015

Current code:

MutableIssue mi=ComponentAccessor.getIssueManager().getIssueObject(issue.getId());
IssueService issueService = ComponentAccessor.getIssueService();
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters();
TransitionValidationResult transitionValidationResult1 = issueService.validateTransition(ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(), mi.getId(), 5, issueInputParameters);
boolean result = transitionValidationResult1.isValid();
if (result) {
IssueResult transitionResult1 = issueService.transition(ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(), transitionValidationResult1);
ComponentAccessor.getIssueIndexManager().reIndex(mi);
}

I use this code on listener class.

With this status get change but it shows only on histroy tab and shows correct transaction but on view issue page it shows wrong (by default) status of issue.

transitionValidationResult is also come true. but still on view issue page shows wrong status.

but on history is shows right transaction.

what will be the problem for this?

 

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 15, 2015

Oh gods, no, you haven't tried to change the endpoint of a transition? Do not do that, it breaks. Every time.

You need to craft a listener that performs another transition outside the current transition, not within it.  Have a look at the auto-transition listener in the Script-runner.

Sandor Krisztian Andre March 10, 2017

How is he changing the endpoint? I see only one operation here, a transition.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 11, 2017

A transition changes the status (step) from anything to a new status.  There can only be one target status.  So saying "I will put it in another status" is changing the endpoint, and makes the transition pointless.  Do NOT try it.

0 votes
Sachin Dhamale June 15, 2015

Thanks Nic for reply.

In my scenario.

There are two transaction from "open" status one is "In Process" and another is "Resolve"

  1. start progress transaction for "In Process"

      2. Resolve(5) transaction for "Resolve"

But I want to redirect Resolve Status from start progress transaction for that i write above code.

and its working because it show in history tab.  first open > inprocess and then In process > Resolve.

but on view issue page it show "In Progress" which is by default instead of "Resolve"

 

 

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 15, 2015

That's very odd.  It suggests that the history has been written to, but the transition has not actually been done.  The issue view page is generally read directly from the database, so it's not "wrong" in terms of what it's telling you, it's just displaying the current state of the data.  What is "wrong" is the failure to proceed through the transition (and the write to history is even more wrong!)

Could you do a quick check - go to the issue view and check what transitions are now available - is it none at all, or the ones for the currently shown status, or the ones for the status it should have ended up in?

Sachin Dhamale June 15, 2015

Nic, available transaction is not correct for displaying status. it shows transaction for status which showing in the history tab.

Sachin Dhamale June 15, 2015

That means status in the history and its related transaction on view issue page is updated but status on view issue page is not showing correctly

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 15, 2015

Wow, you've managed to do the complete opposite of what everyone else does. The issue view is almost always "right" and it's everything else that is broken around it.

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