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:
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.