APEX controller is not defined

  • 1
  • Question
  • Updated 1 month ago
  • In Progress
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
Photo of Peter Herzog

Peter Herzog

  • 1,664 Points 1k badge 2x thumb
  • dumb

Posted 1 month ago

  • 1
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
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.
Photo of Peter Herzog

Peter Herzog

  • 1,664 Points 1k badge 2x thumb
Ah! I am in classic for both environments but one has lightning enabled and the other does not.   
Photo of Peter Herzog

Peter Herzog

  • 1,664 Points 1k badge 2x thumb
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. 
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
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.

https://community.skuid.com/skuid/topics/clarification-needed-on-skuid-10-0-0-release-notes-related-...