function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DrBix65DrBix65 

Managed Package Question

Our company is in the process of trying to create and license our software.  One of the issues that I'm having is providing in such a way that the licensee can customize it.  For example, we have pages that include our company's name on it.  What I'm trying to do is allow the customer to change that particular item.  However, because we're distributing the application as a managed package, the client is unable to modify anything.  I've tried using custom labels, but the same issue occurs.  Once the manage package is deployed in a client's org, the labels become read-only.  The only thing that I've come up with would be a cusom object, and that complicates things considerably.  For example, for a custom label, a Visualforce page would simply use {!$Label.Company_Name} as the reference.  If I use a custom object, then it's not as simple and would actually cause a SOQL query on each page load.

 

My question is:  Is there any "best practice" in a managed package  that allows a client to customize certain aspects of the application?

 

Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 
BritishBoyinDCBritishBoyinDC

Take a look at Custom Settings...I saw this presentation at Dreamforce this year where he is using Custom Settings to store all his labels for a VF page:

https://github.com/nzgonjanin/Dreamforce2012

 

You'll see in his code he references them like this, where AddtoCampaignsSetting__c is his custom setting, and column_Select_Header__cis the field name on the setting:

 <apex:pageBlockTable value="{!Campaign_List}" cellPadding="4" 
                        border="1" var="Camp" rendered="false"> 
            <apex:column >
               <apex:facet name="header" >{!$Setup.AddtoCampaignsSetting__c.column_Select_Header__c}</apex:facet>
               <apex:inputCheckbox id="Selected" value="{!Camp.checked}" disabled="{!Camp.disabled}"/>
            </apex:column>

 

Depending on how you implement the setting, you can control the access someone has to the setting, so I think this is probably your best bet. And now you can run scripts on install/update of a package, you can run a simple script to populate the custom setting on install from code/static resource or even a web service...

 

 

All Answers

BritishBoyinDCBritishBoyinDC

Take a look at Custom Settings...I saw this presentation at Dreamforce this year where he is using Custom Settings to store all his labels for a VF page:

https://github.com/nzgonjanin/Dreamforce2012

 

You'll see in his code he references them like this, where AddtoCampaignsSetting__c is his custom setting, and column_Select_Header__cis the field name on the setting:

 <apex:pageBlockTable value="{!Campaign_List}" cellPadding="4" 
                        border="1" var="Camp" rendered="false"> 
            <apex:column >
               <apex:facet name="header" >{!$Setup.AddtoCampaignsSetting__c.column_Select_Header__c}</apex:facet>
               <apex:inputCheckbox id="Selected" value="{!Camp.checked}" disabled="{!Camp.disabled}"/>
            </apex:column>

 

Depending on how you implement the setting, you can control the access someone has to the setting, so I think this is probably your best bet. And now you can run scripts on install/update of a package, you can run a simple script to populate the custom setting on install from code/static resource or even a web service...

 

 

This was selected as the best answer
DrBix65DrBix65

Is there a way to "auto-run" a script upon installing a managed package or just something you do from the console or in Eclipse?

BritishBoyinDCBritishBoyinDC

Yes - they added the functionality in Spring 12 I think...see docs here for details

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_install_handler.htm

DrBix65DrBix65

Excellent!  Thank you for the response!