How to trigger the create-linked-issue dialog from a JIRA plugin?

Anja Kleebaum October 23, 2018

We want to trigger the create-linked-issue dialog from our JIRA plugin:

grafik.png


We know how to trigger the quick-edit-issue and the quick-create-issue dialogs. To use these dialogs, we included the following dependencies in our atlassian-plugin.xml:
<dependency>com.atlassian.jira.jira-quick-edit-plugin:quick-edit-issue</dependency>
<dependency>com.atlassian.jira.jira-quick-edit-plugin:quick-create-issue</dependency>

In Javascript, we use the following code to trigger the create-issue-dialog:

var createCreateIssueForm = require('quick-edit/form/factory/create-issue');
createCreateIssueForm({
        }).asDialog({
    windowTitle : createKnowledgeElementText
    }).show();
    closeDialog();

 How can we use the create-linked-issue dialog?

grafik.png

1 answer

1 accepted

1 vote
Answer accepted
Daz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 6, 2018

Hi @Anja Kleebaum,

This dialog is a little... tricky, for a number of reasons.

Depending on the section of the application you are in, there are a few implementations of this dialog.

In the core of Jira, there is a `jira.webresources:dialogs` web-resource, which will load a `jira/dialog/link-issue-dialog-factory` AMD module. This module exposes a `createLinkIssueDialog` function, which accepts a single "trigger" parameter, which can be either a DOM node or CSS selector. 

Here's the problem, though: the issue ID for the dialog is retrieved from a page-specific API which is probably not implemented on every page. In other words, it is tightly coupled to the pages it was intended to be used on, and isn't inherently re-usable.

If you're on the view issue page, it will probably work. But, then again, if all you wanted to do was trigger the existing issue link dialog on the existing issue view page, you could instead programmatically click a ".issueaction-link-issue" element to open it.

 

Rather than attempting to re-use the pieces of Jira's link issue dialog, it may instead be simpler to construct your own dialog, then interface with Jira's REST endpoint for managing the issue link data: 

One final note: as this is a development question, you may get more prompt assistance in future on our developer community forum: community.developer.atlassian.com

Cheers,

Daz

Anja Kleebaum December 6, 2018

Hi @Daz,

thanks a lot for your answer! We constructed our own "create-and-link-dialog" and will stick with it:

grafik.png

Suggest an answer

Log in or Sign up to answer