0

I'm developing a Lightning app that uses Custom Apex Classes. I have admin privileges and through the app can execute methods in the Apex class without issue.

When logged in as another user, I can't access the method.

Initially I thought this was an Access privilege issue, so I added the user profile to the Enabled Profiles. This had no impact.

Again, the class and method work fine for me (I have a sys admin profile). But the component error

Uncaught Unable to find action 'getMyObjects' on the controller

Why do I get this error? How can I fix it?

  • 1
    It may not make a difference, but it might be useful if you could share some code. – sfdcfox Apr 10 '19 at 4:47
  • This is most likely a Lightning caching issue. I've had this multiple times during development myself (where I added a function to my Apex controller and the lightning framework kept insisting it didn't exist)... I have not found any solution other then to helplessly keep saving the component and controller over and over and hitting ctrl+f5 in the browser until it works. – rael_kid Apr 10 '19 at 5:57
  • Thank you for the reply. Since my problem was 100% repeatable and consistent i'm ruling out caching. The problem was uniquely associated with non-admin users. – el Jeffe Apr 12 '19 at 3:37
0

My solution was to change the Apex class definition from public with sharing class to public without sharing class This change causes the class to ignore sharing rules. This works for now, but I'll need to research the sharing rules then enable to limit access to users with specific profiles.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.