Create Issue Dialog filling the summary and description does not work

I’m trying to launch the issue creation dialog passing the summary and description parameters and it doesn’t work.

JIRA.Forms.createCreateIssueForm(
    {
      pid: 10200,
      issueType : 10100,
      summary: "Summary",
      decription: "Description"
      }
).asDialog().show()

The dialog opens, but the summary and description fields are not filled in and there is no error in the console.

I have seen in the network tab of the chrome devtools, that the dialog is called and it only passes the issue type and the project id as a parameter.

That could be happening?

Thanks in advance.

How did you find this component/documentation?

As far as I can see from the code, it only takes pid and issueType.
You probably have to set those fields in the dialog using JS

We currently bind a function to the event ‘dialogContentReady’ before calling the show method. Within this method we do modify the input elements manually. In addition, we use a unique id in asDialog to not cause a conflict with other dialog (make sure that the opened Dialog has this id)

.asDialog({id: 'somethingUniqueOrGenerated'})

I’m not sure about this, but should check switching issueTypes

If anyone has a better solution, let us know so that we could change it to something better

Hi,
I have found it in the following topic:

And the names of the fields I have based on the following documentation.
https://confluence.atlassian.com/jirakb/how-to-create-issues-using-direct-html-links-in-jira-server-159474.html

Hi,
Currently I am doing this, using the ‘dialogContentReady’ event and filling the value from javascript to the summary and description fields. But I would have liked to do it through the component.

1 Like

It looks to me like this JavaScript component is meant to just display a create issue dialogue, and expects the user to enter details such as description.

To fill it programmatically, dialogContentReady seems like a good choice

I am currently also looking for a way to populate inputs, text areas and dropdown with predefined values via JS. Did you find a working solution? If yes could you please share an exmaple.

This may be a bit old, but I just found a possible solution that may work a bit cleaner (Not yet tested in a lot of Jira Versions)
This will init the create issue screen with a specific issuetype, summary and a custom field (in my case story points)

window.requirejs(
	['jira/inline-issue-create/prefillable-create-issue-dialog', 'jira/jquery/deferred'],
	(prefillableCreateIssueDialog, Deferred) => {
		const initialValuesDefer = new Deferred();
		const createIssueForm = prefillableCreateIssueDialog.createPrefillableCreateIssueForm(initialValuesDefer);
		createIssueForm.pipe((form) => {
			const b = form.asDialog();
			b.show();
			return b;
		});
		initialValuesDefer.resolve({
			prefilledFields: {
				pid: 10000, //ProjectId
				issuetype: 10001,
				summary: 'test',
				customfield_10105: 15,
			},
		});
	},
);

//Edit: Fixed project and issue type parameter