Search code examples
jiraissue-tracking

In Jira can I create an issue, and link it at the same time?


I have a list of "Business Needs" (custom type) each need should be implemented by an "Epic".

How can I add a thing to a "Business Need" that will let me create an "Epic" with the link created automatically?


Solution

  • You can achieve this by developing a new Jira-Plugin.

    This could consist of two parts:

    1. Define a new menu entry in the jira application menu
    2. Define a jira-action which does your linking stuff

    Defining a new menu entry is rather simple: The needed plugin-type is Web Item Plugin Module. For this you just have to make an entry in your atlassian.xml:

    <web-item key="foo" name="Foo"
            section="operations-top-level" weight="47">
            //snip...
            <label>Foo action</label>
            <link linkId="foo">
                <![CDATA[/secure/FooAction!default.jspa?issue=${issue.id}]]>
            </link>
    </web-item>
    

    After doing so you can define the action you want to trigger when clicking the action. For this you can use a Webwork plugin

    <webwork1 key="fooaction" name="FooAction" class="java.lang.Object">
    //snip...
    <actions>
            <action name="fooaction" alias="FooAction"></action>
        </actions>
    </webwork1>
    

    In you FooAction-class you just can do your linking stuff:

    public class FooAction extends JiraWebActionSupport {
        @Override
        @RequiresXsrfCheck
        public String doExecute() throws Exception {
             ComponentAccessor.getIssueLinkManager().createIssueLink(...);
        }
    }