You need to sign in to do that
Don't have an account?
Nathan A
How do I let end-users build Visualforce Pages that use classes installed by my packages?
I have an application that's been installed by one of my clients. This application includes a Controller Extension that is defined as a global class.
I'd like the client to be able to create Visualforce Pages that use that custom Controller Extension. Currently when they attempt to do this they get the following error:
Error: Apex class 'LeadControllerExtension' does not exist
When attempting to create the following basic page:
<apex:page standardController="Lead" extensions="LeadControllerExtension" > <!-- Begin Default Content REMOVE THIS --> <h1>Congratulations</h1> This is your new Page <!-- End Default Content REMOVE THIS --> </apex:page>
Any ideas?
I still don't know what the best practices are for using the global keyword, but I was finally able to overcome my problem by using dot-notation for the namespace prefix like this:
I never ceased to be amazed how how much of a complete mess the standards and practices are for Apex development. It's a random hodgepodge of protocols and instruments.
Now I'm having a whole new problem surrounding the use of:
All Answers
I've tried going to the Version info on the VF page that's being created and including the Package that has the controller extension, and that didn't work.
There must be a way to do this. How does one write VF pages that access objects and classes from installed packages?
I am assuming the installed package is managed. If that is the case there is not a way to access these classes. Manage packages means your code is private and cannot be accessed except by the applications in you managed package.
the client probably just needs to add the namespace prefix.
class libraries certainly are possible, see "apex-lang" which I recall you can get as managed or un-managed.
If you declared class and class members as global you can access out side of a managed package.In yours sample code you did't added the namespace
suppose you global class is Myclass
when access in a unmanaged code you need to accees the class namespace__c.MyClass.
Hmm.... well if I do this:
I get this error:
I don't appear to have improved the situation any. The latest version of my package is added under the "Version Settings" Tab, and I've verified that the method descriptors for the Class are shown when going to the Apex Classes section in Setup and clicking on the LeadControllerExtension entry.
My LeadControllerExtension Class relies on another Class from my package called DeploymentManager, does that package also have to be flagged as global even though I'm not directly accessing any of its methods from outside the package?
Making the dependent Class also be set as global (along with its methods) didn't help either.
This is beyond aggravating.
I still don't know what the best practices are for using the global keyword, but I was finally able to overcome my problem by using dot-notation for the namespace prefix like this:
I never ceased to be amazed how how much of a complete mess the standards and practices are for Apex development. It's a random hodgepodge of protocols and instruments.
Now I'm having a whole new problem surrounding the use of:
You are correct.For got to mention in previous post.If you observed after packing components in VF page class are access using namespace.controller name