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 the IssueService
(http://docs.atlassian.com/jira/latest/com/atlassian/jira/bc/issue/IssueService.html). Here's is how you do it:
Get the
IssueService
object either by injecting it in the constructor or as follows:IssueService issueService = ComponentManager.getInstance().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 so on! It represents an issue builder...