Fill openCreateIssueDialog with a linked issue

Hey guys,

I was wondering how can I pre-fill linked issue field with openCreateIssueDialog method. I know there is a second argument containing fields key, where it should be, but I tried multiple ways - passing string, passing stringified array with one string, passing stringified array with object (variety of key sets - from key,value to the whole issue object which comes from the backend on opening issues list). I’m using issuelinks-issues key (also tried issues, issuelinks).

From time to time I’m also having problems with setting issuelinks-linktype field - it usually ends up with selecting the first one. Weird part is that it sometimes works…

Any ideas? Thanks!

4 Likes

@dmorrow, maybe you can get some example from Jira dev team (if it is supposed to work)?

Thanks!
Jack

@kkercz, maybe you can help us here with an example or just a short answer that it is not possible?

I haven’t tested it, but looking at the code, something like this might work:

JIRA.Forms.openCreateIssueDialog({
    pid: 10000,
    issueType: 2,
    fields :{
        "isCreateIssue": true,
        "issuelinks-linktype": "Name of the link type",
        "issuelinks-issues": "linked issue key"
    }
}).asDialog().show();
1 Like

@kkercz thanks, but unfortunately that doesn’t work :confused:

Do you, by any chance, have any other ideas? :slight_smile:

I’m afraid not. We must accept that it’s not possible then. I would suggest creating a feature request in the ACJIRA project.

1 Like

Hi guys,
I faced the same problem. Are there any updates here?

I’ve created a ticket in ACJIRA, but unfortunately it’s not solved yet :confused:

https://ecosystem.atlassian.net/browse/ACJIRA-2233

Hi @IgorPasieczny ,
Thank you for response :slightly_smiling_face: . Can you tell how you fill in the Isselinks-Linktype field, that it sometimes works?

From what I remember it was exactly the way @kkercz suggests - passing the name of link type.

Thank you @IgorPasieczny , but, unfortunately, the dialog still opens with the first issue link type…

It worked for me this way:

issueData.fields.issuelinks = 'issuelinks';
issueData.fields['issuelinks-linktype'] = 'relates to';
issueData.fields['issuelinks-issues'] = issueKey;

Unfortunately, the Linked Issues field must be present in the dialog window.