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

Using IssueService.transition leaves the status field unchanged, not linked to new step - Jira 5

Andrew Heald March 26, 2013

I'm using the following snippet of code in a workflow post-function that is being used only by sub-tasks. I'm transitioning the parent task. In this context issueToBeApproved is set to the parent issue and is a MutableIssue. The transitionActionId is correct and the transition succeeds and shows as a transition on the Transitions Summary tab on the Jira issue page. But the status remains unchanged and still indicates the original linked status, not the new linked status. If I manually click the transition button on the parent issue then the transition works as expected.

I can't see anything written anywhere about having to explicitly set the status field after the transition, so where am I going wrong?

User user = jiraAuthenticationContext.getLoggedInUser();
boolean transitionFailed = true;
log.warn("Validating workflow transition action id " + transitionActionId + " on " +
         issueToBeApproved.getKey());
IssueService.TransitionValidationResult transitionValidationResult =
        issueService.validateTransition(user, issueToBeApproved.getId(), transitionActionId,
                issueService.newIssueInputParameters());
if (transitionValidationResult.isValid()) {
    log.warn("Running workflow transition action id " + transitionActionId + " on " +
            issueToBeApproved.getKey());
    IssueService.IssueResult issueResult = issueService.transition(user, transitionValidationResult);
    if (issueResult.isValid()) {
        transitionFailed = false;
    }
}

Many thanks,
Andrew.

9 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Séb P.
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.
October 13, 2013

Same for me on Jira 6...

Sven Lecherbonnier January 5, 2016

Your solution is working on JIRA7 : {code} issueService.transition(u, tvr); issue.setStatusObject(ir.getIssue().getStatusObject()); issueManager.updateIssue(u, issue, EventDispatchOption.ISSUE_UPDATED, false); {code}

0 votes
Sven Lecherbonnier January 5, 2016

+ 1 Sébastien, no issue with JIRA7

0 votes
KenS May 3, 2014

Seb's workaround not working for me on Jira 6.2.3. I tried the reindex as well, no luck.

Anyone know if this is an acknowledged bug?

This is quite frustrating.

0 votes
KenS May 3, 2014

Seb's workaround not working for me on Jira 6.2.3. I tried the reindex as well, no luck.

Anyone know if this is an acknowledged bug?

This is quite frustrating.

0 votes
Séb P.
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.
October 28, 2013

Hi, yeah for me that sounds like a bug. In my opinion, issueService.transition should take care of the whole process. Glad to know it helped you :)

0 votes
Tobias Kloht October 24, 2013

Seb your answer saved me. This is a bug, right?

0 votes
Séb P.
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.
October 13, 2013

I found a way to make this work:

IssueResult ir =

issueService.transition(u, tvr);

issue.setStatusObject(ir.getIssue().getStatusObject());

issueManager.updateIssue(u, issue, EventDispatchOption.ISSUE_UPDATED, false);

0 votes
Séb P.
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.
October 13, 2013

same behavior...

0 votes
Christian Czaia _Decadis AG_
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.
October 13, 2013

I use sth. like this to perform a re-index... Just a thought...

issueIndexManager.reIndex(validationResult.getIssue())

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