Programmatically progressing on workflows
Another operation that we perform normally on workflows is to programmatically transit the issues through its workflows. Let us have a look at how to do this using the JIRA API.
How to do it...
Since JIRA 4.1, transitioning issues is done using IssueService
(http://docs.atlassian.com/jira/latest/com/atlassian/jira/bc/issue/IssueService.html). The following steps shows how to programmatically transit the issues workflows:
Get the
IssueService
object either by injecting it in the constructor or as follows:IssueService issueService = ComponentAccessor.getIssueService();
Find out the action ID for the action to be executed. You can either get it by looking at the workflows (the number within brackets alongside the transition name) if you know it is not going to change, or retrieve it using the action name (refer to the previous recipe).
Populate the
IssueInputParameters
if you want to modify anything on the issue such as assignee, reporter, resolution, and...