Programmatically progressing on workflows
Another operation that we perform normally on workflows is to programmatically transition the issues through its workflow statuses. Let us have a look at how to do this using the JIRA API.
How to do it...
Transitioning issues is done using the IssueService (http://docs.atlassian.com/jira/latest/com/atlassian/jira/bc/issue/IssueService.html). Here is how you do it:
Get the
IssueServiceobject, 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 (that is, the number within brackets alongside the transition name) if you know it is not going to change, or retrieve it by using the action name (refer to the previous recipe).
Populate the
IssueInputParametersif you want to modify anything on the issue, such as assignee, reporter, resolution, and so on! It represents an issue builder...