Creating an issue from a plugin
In this recipe, we will see how to create an issue from a plugin programmatically. Prior to version 4.1, JIRA used IssueManager
to create an issue. From JIRA 4.1, there is this IssueService
class that drives the issue operations. Since IssueService
is recommended over IssueManager
, we will use it in our recipes to create an issue.
How to do it...
The main advantage of IssueService
over the IssueManager
class is that it takes care of the validation and error handling. The following are the steps to create an issue using the IssueService
:
Create an instance of the
IssueService
class. You can either inject it in the constructor or get it from theComponentManager
, as shown:IssueService issueService = ComponentManager.getInstance().getIssueService();
Create the issue input parameters. In this step, we will set all the values that are required to create the issue using the
IssueInputParameters
class.Create an instance of the
IssueInputParameters
class.IssueInputParameters...