Search code examples
salesforceapex-codevisualforce

Salesforce - Hiding visualforce form items based on organization


I have a custom viusalforce page as part of a package that i'm developing. The package will be installed on a number of different Salesforce organizations. I require to hide certain parts of the visualforce page (input boxes) based on the organization using the package. What is the best way to accomplish this? I can hardcode it based on Organization ID but I'm not convinced this is the best way, as when clients refresh sandboxes the ID will change.


Solution

  • You should use rendered attribute on apex:input evaluating the org criterial:

    <apex:input ... rendered="{!facility.Facility_Address_2__c!=''||render}" ...>
    

    Where facility.Facility_Address_2__c could be the inline evaluation criteria of some org object.field value or render could be a flag set on controller evaluating a deeper criteria.