I want to run some javascript once the Service Desk portal form is loaded.
I found some examples to use this, but I don’t think this is working on the Service Desk Portal side:
AJS.$(function() {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context, reason) {
if (AJS.$('#my-test-element').length != 0) {
if (reason == JIRA.CONTENT_ADDED_REASON.pageLoad) {
console.log("Page Load");
} else if (reason == JIRA.CONTENT_ADDED_REASON.panelRefreshed) {
console.log("Panel Refreshed");
}
}
});
});
Is there an equivalent that works each time the user loads a new form? Bonus points if it also works when user navigates back out to the main portal, and clicks on another form.