I have a class in my managed package: global class myExtensionClass - which is extenison controller. I installed this package in test salesforce developer account. When user click one of the button this code runs: It is responsible for creating apex page for object that exists in account where package is installed.

    // PackageVersion 
    MetadataService.PackageVersion packVer = new MetadataService.PackageVersion();
    packVer.namespace = 'myNamespace';
    packVer.majorNumber = 1;
    packVer.minorNumber = 6;

        // VF page - Create Commission
        String createCommissionVfPage = 
        '<apex:page standardController="existingCustomObject" extensions="myExtensionClass" showHeader="false" standardStylesheets="false">'
            +'<apex:iframe src="{!url}" width="100%" height="900px" scrolling="true" />'

        MetadataService.ApexPage apexPage2 = new MetadataService.ApexPage();
        apexPage2.apiVersion = 29;
        apexPage2.fullName = 'Do_Something_Co';
        apexPage2.label = 'Do something';
        apexPage2.content = EncodingUtil.base64Encode(Blob.valueOf(createCommissionVfPage));
        apexPage2.packageVersions = new List<MetadataService.PackageVersion> { packVer };

            new List<MetadataCreateJob.Item> {
                new MetadataCreateJob.Item(apexPage2)
            new MetadataCreateJob.EmailNotificationMetadataAsyncCallback()

But it fails with this error:

Metadata Deployment Resutls: Apex class 'myExtensionClass' does not exist. How do I make this class accessible in other organization where my managed package is installed? I thought global modificator is what I need, but it still doesn't work.

The same when I create new class that tries to access this global class it returns error: Error: Compile Error: Invalid type: myExtensionClass at line 4 column 40

public class globalTest {

    public globalTest() {
        myExtensionClass ac = new myExtensionClass();

1 Answer 1


If the code you have posted is in the org that the managed package is installed in rather than within the managed package itself, you will need to include the managed package namespace prefix in the references to the class.

So if your namespace prefix is "xxx":


xxx.myExtensionClass ac = new xxx.myExtensionClass();

Also see Stephen's comment.

  • You'll also need to keep this in mind for referencing custom objects and fields. See: salesforce.com/us/developer/docs/apexcode/Content/…
    – Stephen
    Mar 14, 2014 at 18:46
  • Thanks for super fast, correct answer! It worked. Before I was trying this format and it didn't work: myNamespace__myExtensionClass.
    – gpszymczak
    Mar 14, 2014 at 19:00
  • Your are welcome. As @Stephen mentions, you'll probably be typing myNamespace__ a lot too...
    – Keith C
    Mar 14, 2014 at 19:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .