Facing issue with creating a button on the create screen using Atlassian SDK.

Sailen Sahoo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 1, 2025

Hello,

I am trying to create a button on the create issue screen using a web resource. 

Can anyone help me understand what I am missing or doing wrong ?

I am trying to access the script from the web resource:

 

AJS.toInit(function() {

function addButton() {
const createIssueDialog = document.querySelector('#create-issue-dialog');
const descriptionField = document.querySelector('#description');
if (descriptionField && createIssueDialog) {
console.log('Description field found');
const createIssueButton = document.createElement('button');
createIssueButton.innerHTML = 'Log to console';
createIssueButton.style.display = 'block';
createIssueButton.style.marginTop = '10px';
createIssueButton.style.backgroundColor = 'red';
createIssueButton.onclick = function() {
console.log('create issue button clicked');
};
descriptionField.parentNode.insertBefore(createIssueButton, descriptionField.nextSibling);
} else {
console.log('Description field not found');
}
}

if (document.querySelector('#create-issue-dialog')) {
addButton();
}

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
if (context.closest('#create-issue-dialog').length) {
addButton();
}
});
});

2 answers

1 accepted

0 votes
Answer accepted
Rudy Holtkamp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 2, 2025

Hi @Sailen Sahoo ,

This is probably not the best place to ask this question.

If you repost it here, https://community.developer.atlassian.com/, you are more likely to get an answer.

 

 

Sailen Sahoo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 2, 2025

Hi @Rudy Holtkamp,

Thankyou!!

I did repost the query at developer community.

Like Rudy Holtkamp likes this
1 vote
Sailen Sahoo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 2, 2025

Suggest an answer

Log in or Sign up to answer