I have a question . Let's say that i have a controller and a visualforce page in a Managed package . Can I make the controller so that it accesses the Custom object in the Org ( in which the package has been installed ) without exposing the controller at all ?

  • What do you mean by access? if that is query or dml data - you can do via dynamic query by fetching required sobjects and dml on it. Please, update your question according to site rules - stackoverflow.com/help/how-to-ask
    – kurunve
    Mar 16, 2016 at 11:10

1 Answer 1


The controller in the managed package can have custom settings also in the managed package that nominates custom objects and custom fields that are not in the managed package to be queried/displayed/updated. (Describe calls can also be made to get more information.)

Dynamic SOQL has to be used for the querying and the get/put methods of the SObject base type used to access the data in Apex code. In Visualforce the map-like syntax then has to be used to identify a field:

<apex:repeat var="field" value="{! fields }">
    <apex:inputField value="{! sob[field] }"/>

This only works if you know in advance what you want your controller to do with the custom object e.g. just display it and allow it to be edited so that the code can all pre-exist in the managed package.

  • Thanks for the info . I have one another question . I got the Dynamic SOQL part . But if my visualforce page has to be included in a Custom object's page layout then it's standard controller should match with the object . So how can i come over this situation ? I have to display one VF page in the page layouts of all custom objects . Mar 16, 2016 at 14:51
  • @PruthviRaj The standardController attribute of an apex:page can't be an expression so the best you could do is include a component in your package that then has to be wrapped in a page that nominates the object.
    – Keith C
    Mar 16, 2016 at 16:08

You must log in to answer this question.

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