APEX controller is not defined

Peter Herzog
edited February 25, 2019 in Questions
I need a smack upside the head from the Skuid community.

I am getting a different experience in two environments calling an apex controller - but the APEX class and my skuid page are identical. APEX class has the same permissions. I am using @RemoteAction and calling via

MyClassName.DoSomething(String AccountId)

I verified that the account Id is being passed in. 

One environment works great and another gives me:

Uncaught ReferenceError: MyClassName is not defined
    at ui?page=MySkuidPage&id=001500000100000AAF:335
    at HTMLDivElement.<anonymous> (skuid__SkuidReqsJS:1)
    at HTMLDivElement.ee (skuid__SkuidReqsJS:1)
    at HTMLDivElement.dispatch (skuid__VendorJS:2)
    at HTMLDivElement.q.handle (skuid__VendorJS:2)

Before I start pulling things apart, any thoughts on what could be causing this? #feelingdumb


  • Chandra V
    edited February 25, 2019
    Are your Skuid versions the same?  Are both environments running Lightning Experience?

    If your non working version is a new page (recently copied?), maybe try to click Generate Page Resources?

    Are you declaring your MyClassName before using it? 
    var MyClassName = MyClassName.DoSomething(String AccountId);

    Locker Services requires you to declare everything.
  • Peter Herzog
    edited October 16, 2018
    Ah! I am in classic for both environments but one has lightning enabled and the other does not.   
  • Peter Herzog
    edited October 16, 2018
    Welp, declaring didn't help.  I wonder if this is a skuid version issue.  We are on different versions of Milau 11.2.8 (not working) and 11.1.13 (working). That's probably the cause.  Not seeing anything in the release notes yet. 
  • Chandra V
    edited October 17, 2018
    Could still be a locker service issue, where calling apex from within JS doesn't work anymore.  We moved ours to action sequences, and then call the action sequence from JS instead of directly calling the apex class.

    Here's a post from my colleague when we made the switch, and some links to resources are in the post.

  • If you are using any script file and getting "Uncaught ReferenceError:" which means 'x' is either a variable or a method which you are trying to use before declaring it using var keyword. This means that there is a non-existent variable referenced somewhere. This variable needs to be declared, or you need to make sure it is available in your current script or scope otherwise , it will endup throwing this 'x' is not defined error . This usually indicates that your library is not loaded and JavaScript does not recognize the 'x'. 

    To solve this error: Load your library at the beginning of all your scripts.

    There can be multiple other reasons for this issue:

    ** Path to CDN library you included is not correct

    ** The library file is corrupted

    ** Working offline

    ** Conflict with Other Libraries

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!