+ Start a Discussion
James KeoghJames Keogh 

Change VF page controller in managed package

Hey Guys,

I am trying to modify the CSS in a managed package that is saved as a visual force page, it is controlled by a custom controller that is hidden to me. 

I have cloned the VF page and changed the CSS code I need to, so how do I now point to this new VF page instead of the old one in the managed package. 

Hi James,
You can not edit the visualforce page and apex class in managed packages. All the customization is controlled by the managed package admin.
if you are using Unmanaged package, then you can edit the code as you want.

This is a good doc on what is package-able, edit-able, upgradeable, etc: https://na1.salesforce.com/help/doc/en/salesforce_packaging_guide.pdf (Chapter 3)

Deepali KulshresthaDeepali Kulshrestha
Hi James,

The customer will not be able to modify the VF page. 
The cleanest solution for this problem would be to generate the fields displayed dynamically based on field sets.
Below is an example on using field sets to create VF dynamically. You would probably need to create multiple field sets for different sections of the page etc.
<apex:page standardController="Account">
<apex:form >
<apex:pageblock >
<apex:pageBlockSection title="Account detail">
<apex:repeat value="{!$ObjectType.Account.fieldsets.accountFieldSet}" var="fieldValue">
<apex:Inputfield value="{!Account[fieldValue]}"/>

OR the customer can surely try to override managed package VF page with their custom VF page and/or controller logic if
    -The controller is global
    -All its public properties are global
    -All its public methods are global
The developer in the local org can copy/paste the packaged VisualForce to create their own, and reference the controller, and all its properties and methods. They will need to add the namespace references to class name and object/field names.
If you want them to be able to extend your managed package class and override its methods, then
    -The controller should be defined global virtual
    -All its public methods should be defined global virtual

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha

if its a managed package then still you can surely try to override managed package VF page with their custom VF page and/or controller logic 

https://help.salesforce.com/articleView?id=000332130&type=1&mode=1 (http://https://help.salesforce.com/articleView?id=000332130&type=1&mode=1)