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!
Community moderators have prevented the ability to post new answers.
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()); }
Oh, cool, good to know :) Glad you got it working.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.