+ Start a Discussion

Conditionally hide field on page layout

We have a formula field, GrossBudget__c, that should only be displayed on the layout if a certain condition is true. I don't want to create a visualforce page to replace the entire standard layout. Is it possible to achieve this by creating a visualforce page for just GrossBudget__c and add in a condition that it should only be visible under a certain condition? And then we can just place that mini visualforce page on the standard layout?


If anyone can let me know if this is even possible or point me in the direction of any documentation or blog posts on this it would be greatly appreciated!

Best Answer chosen by Admin (Salesforce Developers) 

For anyone that reads this post later and has the same question, I figured out how. Using "rendered =" is what worked for us:


<apex:page standardController="ProposalFlight__c" showHeader="false" sidebar="false">   
 <apex:pageBlock rendered="{!ProposalFlight__c.ArethereAgencyFees__c == 'YES'}">

   <apex:pageBlockSection title="AGENCY INFORMATION" columns="1" collapsible="true" > 
          <apex:outputField value="{!ProposalFlight__c.FFGrossFlightBudget__c}"/>   
          <apex:outputField value="{!ProposalFlight__c.FFGROSSCPMRate__c}"  rendered="{!ProposalFlight__c.RateType__c == 'CPM'}" />
          <apex:outputField value="{!ProposalFlight__c.FFGROSSCPARate__c}" rendered="{!ProposalFlight__c.RateType__c == 'CPA'}" />