9

I have an Apex class inside my managed package:

global class MyGlobalClass {
    global static void doWork() {
        //...
    }
}

But when I call this code from the org where this package is installed:

MyGlobalClass.doWork();

I get this error:

Variable does not exist: MyGlobalClass

What can I do to make this class available not just inside the package, but also inside org where it's installed?

16

You have to use the namespace to reference a component in a managed package. Just changing the code in the subscriber org should work. Here's the modified version you'd want to use (change packageNS as appropriate):

packageNS.MyGlobalClass.doWork();

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.