+ Start a Discussion
elessenger_ctelessenger_ct 

"Global" Visualforce components in managed packages

We are building a product that includes a Custom VisualForce Component called "CustomSettingAddress" that renders a form on the page using data retrieved from the database via custom SOQL, and then saves data back to Salesforce. This works perfectly in development, and when included in pages that are deployed as part of the G2 package.

 

However, when we attempt to embed this managed component in an unmanaged VisualForce page (e.g. in our customer's org) we are running into security issues. The component itself is global, and we would prefer not to make the controller global, but if we don't then the customer receives a message "the managed class g2.CustomSettingAddressCtl is not accessible". To resolve the problem, we make the controller and all methods global. This allows us to render the form properly, including data from accessor methods that reference other public (but not global) managed classes from within the controller. However, when we attempt to post back to the controller (using a CommandButton) we receive an "insufficient permissions" error.
Any ideas or suggestions on best practices for writing controllers for global components in managed packages? Do we need to make all classes referenced by the controller global as well?
mworld2mworld2

The unknown component error is actually a bug within force.com. I'm told that it's actually a design issue and SF doesn't know when it will be resolved. As a workaround, if the component is part of a managed package then you won't get the unknown component error. In sum: You can't reference a component in the organizations local namespace from within a managed package, but you can reference the component if it's in another managed package. Nice, huh?