Which events to monitor when a portal form is loaded?

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.

1 Like

I’d love to know if there was a hook like this also, however I think we’re in no such luck. I think everyone is loading a js file on the portal location and then adding mutationobservers and such to watch for page changes. :frowning:

1 Like