Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,628
Community Members
 
Community Events
176
Community Groups

Web fragment loses action listener after issue update

I have a webitem displayed on my issues that will generate a username and password. It's hooked up to a web resource like so:image.png

js/user-cred-gen.js:

AJS.$(document).ready(function () {

function genUserCred() {
var issue = JIRA.Issue.getIssueKey();
let url = `/rest/cb-automation/latest/hooks/e6f8904f78fbf84cbb52ce913b553553968b2b31?issue=${issue}`;

$.post({url: `${url}`, headers: { 'Content-Type' : 'application/json'}}, function(result){
console.log("Ran successfully");

JIRA.trigger(JIRA.Events.REFRESH_ISSUE_PAGE, [JIRA.Issue.getIssueId()]);
});
};

function pollDOM(){
const el = AJS.$('#user-cred-gen');
console.log("Polling DOM for #user-cred-gen");
if (el.length > 0) {
AJS.$('#user-cred-gen').click(function(e) {
genUserCred();
});
}
else {
setTimeout(pollDOM, 300);
}
}
pollDOM();
});

When refreshing the page, the button works fine. However, if I edit a field on the customfield pane from the View Issue screen, the button no longer works.

 

1 answer

this is how I'm editing the issue in the customfield pane: image.png

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events