I've written some Javascript for a JIRA instance that automatically fills a field when creating an issue. It works just as expected if I open the 'Create Issue' screen in a new window. However, when 'Create Issue' appears in a dialog box, my script doesn't run. How would I enable my script to run when the 'Create Issue' dialog screen opens in a window? Below is my code:
/*
* Automatically fills the summary field of an issue and hides the field at issue creation.
*/
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
autoFillSummary();
});
autoFillSummary();
// Automatically fill the summary field with a default value.
function autoFillSummary(){
var issueType = $('#issue-create-issue-type').text();
var reporter = $('#reporter').val();
var d = new Date();
d = d.toDateString();
var summaryVal = reporter + " - " + "[ " + d + " ]";
if(issueType === "Job"){
$('#summary').val(summaryVal);
$('#summary').closest('div.field-group').hide();
$('#reporter').closest('div.field-group').hide();
}
}
});
The id for the dialog is create-issue-dialog Thank you in advance for any help you can provide me.