Popup Create on top of an issue already being created.


I'm using javascript to add a template to the description field for a JIRA issue.

Everything works fine except when you press create when you are already on the issue creation screen.  A popup window appears but my description field is empty.  When I am on other screens and I press create issue and the pop up appears there is no problem.  The description field is populated.

Any ideas on why this might be happening?


Here is the code I use:

// Add template text to an old-style non-lightbox issue create screen
function addOldText(area) {
if (AJS.$("#issue-create-submit") == null || AJS.$("#issue-create-submit").length == 0) {

var projectName = AJS.$("#issue-create-project-name")
if (projectName != null && projectName.length == 1) {
// innerText is Chrome only
var projectName2 = projectName[0].innerHTML;

var issueType = AJS.$("#issue-create-issue-type")
if (issueType != null && issueType.length == 1) {
var issueType2 = issueType[0].innerHTML;

if (projectName2 != null && issueType2 != null) {
addText(area, projectName2, issueType2);

// Add template text to a lightbox issue create screen
function addNewText(area) {
// Only when creating issues
if (AJS.$("#create-issue-submit") != null && AJS.$("#create-issue-submit").length != 0) {
// Find the name of the currently selected project

var projectName = AJS.$('#project-field').val();
var issueType = AJS.$('#issuetype-field').val();
addText(area, projectName, issueType);

function addText(area, projectName, issueType) {
// Add text to the description in the projectName object. The
// field may have text from a previous choice but overwrite it
// area variable is for logging.
if (projectName != null) {
templateText = "";
if (projectName == "TalentSpace Suite (HGN)" || projectName == "TalentSpace Suite" || projectName == "Careers Website" || projectName == "e360-V6" || projectName == "EPM Db" || projectName == "Foundation" || projectName == "Mobile" || projectName == "HRIS Connect" || projectName =="OAuth Server" || projectName =="Outlook Plugin") {
if (issueType == "Bug") {
// Note that both new line and line continuations are used here
var templateText = "Build number\nSite (If applicable)\nBrowser\nExpected results\nActual result\nSteps to reproduce\n\Any workaround or mitigation.\n";

console.log(AJS.$("#description").length )
if (AJS.$("#description") != null && AJS.$("#description").length > 0) {
AJS.$("#description")[0].value = templateText

(function($) {
// init on load
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
// init on refresh

2 answers

1 accepted

0 votes
Accepted answer

Thanks for the answer Pedro...good guess.  I did eventually figure it out.  It was because description turned out to be an array due to there being two on the screen.  So the script was operating on the description behind the popup screen. 

Hi, I have the same problem. Did you manage to get it working?

0 votes
Pedro Cora Atlassian Team Apr 29, 2015


This is probably happening because your script is being called on load of the Create Screen and when you call it while already being in the screen the script is not being loaded.


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,234 views 5 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you