Creating an issue from a plugin

In this recipe, we will see how to create an issue from a plugin programmatically. We will be using IssueServiceto take advantage of its validation and error handling capabilities.

How to do it...

Following are the steps to create an issue using the IssueService:

  1. Create an instance of the IssueService class. You can either inject it in the constructor, or get it from the ComponentAccessor, as shown:
            IssueService issueService = ComponentAccessor.getIssueService();
  2. 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:

    a. Create an instance of the IssueInputParameters class:

                IssueInputParameters issueInputParameters ...

Get JIRA Development Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.