I have a VF Page like below -- what I am trying to do is hide values appearing in the table if they have a certain tickbox ticked -- so this page is looking at Opp Products - if the Product has the tickbox Forecast ticked I dont want it showing up here in my Table - any ideas?? - I have tried rendered field in a few places but i either get rid of everything or it stops an edit on any product added -- the code is not mine originally but I would like to ammend it to do this.

<apex:page standardcontroller="Opportunity" extensions="Opportunity_Product_Manager_Controller2" title="Opportunity Product Manager" tabStyle="Opportunity" action="{!processPageActions}">

<apex:form >
     <apex:ActionStatus id="pleasewait" >
        <apex:facet name="start">
            <c:Load BackColor="#FFFFFF" borderColor="#FFFFFF" borderSize="2" height="50px" width="180px" Message="Processing..." messageStyle="color:darkred;font-size:10pt;font-family:arial;" ImageUrl="/img/loading.gif"/>
    <apex:pageBlock title="Opportunity Product Manager" id="OPM">
        <apex:pageBlockSection title="Opportunity Details" id="OpportunityDetails">
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Opportunity"></apex:outputLabel>
                <apex:outputLink value="/{!source.Id}"><apex:outputField value="{!source.Name}"/></apex:outputLink>
            <apex:outputField value="{!source.Closedate}"/>
            <apex:outputField value="{!source.Amount}"/>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Solution Start Date"></apex:outputLabel>
                <apex:outputPanel >
                    <apex:outputField value="{!defaultbaseRLI.Date__c}" />
        <apex:pageBlockSection title="Add Product" id="Data" columns="1">

            <apex:pageblockTable value="{!OpportunityProducts}" var="oppProd" >
                <apex:column headerValue="" width="30px">
                    <apex:facet name="header">
                        <apex:commandButton title="Add Product" value="Add Product" action="{!AddProduct}"/>
                    <apex:commandButton title="Edit" value="Edit" action="{!manageSelectedProduct}" rerender="mess,ProductDetails" status="pleasewait">
                        <apex:param name="selectedProductId" value="{!oppProd.oli.Id}" assignTo="{!selectedOppProdId}"/ >
                <apex:column headerValue="Product" value="{!oppProd.oli.PricebookEntry.Name}"   />
                <apex:column headerValue="Quantity" value="{!oppProd.oli.Quantity}" />
                <apex:column headerValue="Total Value" value="{!oppProd.oli.TotalPrice}" />
                <apex:column headerValue="Once Off Cost" value="{!oppProd.oli.Once_Off_Cost2__c}" />
                <apex:column headerValue="Date" value="{!oppProd.oli.Start_Date__c}" />
                <apex:column value="{!oppProd.oli.Product_Solution_Area__c}" />
                <apex:column value="{!oppProd.oli.Product_KPI__c}"/>
                <apex:column headerValue="" width="30px">
                    <apex:commandButton title="Remove" value="Remove" action="{!RemoveSelectedProduct}" rerender="mess" status="pleasewait">
                        <apex:param name="selectedProductId" value="{!oppProd.oli.Id}" assignTo="{!selectedOppProdId}"/>
  • that should be handled inside the controller, can you paste the controller code? Sep 15, 2014 at 11:54

1 Answer 1


You can do this using the rendered attribute:

A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true.


  • so i tried this <apex:column headerValue="Product" value="{!oppProd.oli.PricebookEntry.Name}" rendered="{!oppProd.oli.Forecast__c=FALSE}"/> <apex:column headerValue="Quantity" value="{!oppProd.oli.Quantity}" rendered="{!oppProd.oli.Forecast__c=FALSE}"/> <apex:column headerValue="Total Value" value="{!oppProd.oli.TotalPrice}" rendered="{!oppProd.oli.Forecast__c=FALSE}"/> but got the following error --- SObject row was retrieved via SOQL without querying the requested field: OpportunityLineItem.Forecast__c
    – user6866
    Sep 15, 2014 at 10:56
  • 1
    @user6866 as the error says you dont have OpportunityLineItem.Forecast__c in your SOQL query.
    – Prady
    Sep 15, 2014 at 11:03
  • My bad - ammended that - error is now gone but the values I dont want are still appearing -- code for these lines is --<apex:column value="{!oppProd.oli.Product_Solution_Area__c}" rendered="{!NOT(oppProd.oli.Forecast__c=TRUE)}"/>
    – user6866
    Sep 15, 2014 at 11:11
  • I am having a slow day - that works -- I hadnt ticked the Forecast checkbox -- duhhh ---
    – user6866
    Sep 15, 2014 at 11:55

You must log in to answer this question.

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