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

How to give moved issue a "New" status? - BUMP

Carleen Dickerson
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.
June 20, 2013

Hello - When I move an Issue, I want it's status to become New, no matter what the old status was. What's the best way to go about doing that? I tried to use issue.setTargetStatusId(), but it has no effect.

Thanks!

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Carleen Dickerson
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.
June 24, 2013

Actually, I found an easier way. I implemented a listener for the Move event, set the new status of the incident, and in the listener called workflowManager.migrateIssueToWorkflow.

private void processMoveEvent(IssueEvent ie) {
  MutableIssue issue = (MutableIssue)ie.getIssue();
  issue.setStatusId("10002"); // new
  issue.store();

  WorkflowManager workflowManager = 
        ComponentManager.getComponentInstanceOfType(WorkflowManager.class);

workflowManager.migrateIssueToWorkflow(issue,
   workflowManager.getWorkflow(
        issue.getProjectObject().getId(), 
        issue.getIssueTypeObject().getId(), 
        issue.getStatusObject().getId());
}


Andris Bērziņš
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.
June 25, 2013

Oh, cool, good to know :) Glad you got it working.

0 votes
Andris Bērziņš
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.
June 24, 2013

As far as I know, it's not that simple to change issue's status. First of all, you need a valid workflow transition to this "New" (Open?) status. That means there are seperate transitions from each other state. Also - if those transitions have validators, they will also need to pass.

If all that is ok, then you can use IssueService to transition from one state to another. First you need to call validateTransition and if that is valid, then you can call transition.

TAGS
AUG Leaders

Atlassian Community Events