I am facing AJS ERROR "Uncaught ReferenceError: AJS is not defined" in customer portal page of JIRA SERVICE DESK.
Please find error below.
I have used this dependency com.atlassian.auiplugin:ajs It works for a simple java script alert but not for AJS.
Any help on this is highly appreciated. Thanks in Advance.
Community moderators have prevented the ability to post new answers.
I have changed Jira version to 6.1 and amps.version to 4.2.13 temporarily and it solved the problems.
Hi @Boris
Thanks for your quick reply.
jira.version is: 6.2.2
amps.version is: 4.2.20
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Uninstalling and reinstalling every version under the sun didn't help. I suspect JSD uses asynchronous loading of resources.
As a workaround I setup an anonymous function to check for the AJS call i need to succeed before going to work, an that function is on a recursive timeout to keep checking until it exists.
Also AJS.contextPath yells with an error in JSD pointing to a utility, so I use that instead, but you can check whatever JS/AJS call you need to be present.
// this must be a named function to be able to call itself function onFunctionAvailable(testCondition) { if (testCondition() === true) { console.log("AJS Methods Ready"); // test passed, methods are ready, do work callbackMethodWhenStuffIsPresent(AJS.$); } else { // methods not yet present/ready, check back in 50ms console.log("AJS Methods not ready"); setTimeout(function () { onFunctionAvailable(testCondition); }, 50); } } //this calls the method above, but uses anonymous function to prevent immediate error when argument is evaluated. // replace 'require("servicedesk/util/context-path")' with whatever method/call you need to be present onFunctionAvailable(function (){try{return typeof(require("servicedesk/util/context-path")) === 'string';}catch(err){return false;}});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Which version of JIRA are you using ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.