Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Sailen Sahoo 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 Champion
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 January 2, 2025

Hi @Rudy Holtkamp,

Thankyou!!

I did repost the query at developer community.

Like Rudy Holtkamp likes this

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, likes for trees, atlassian community, social impact, tree planting campaign, community kudos, atlassian giving, environmental impact, sustainability, likes for good, atlassian social responsibility, community challenge

Make every click count—help us plant 50,000 trees! 🌳

Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!

Help us plant more trees
AUG Leaders

Atlassian Community Events