0

I am getting the Unknown property error. I understand that there are other posts that address this, but as somebody who does not know how to code, I do not know how I should be changing my specific code. Any help is appreciated. I am trying to only render products in a table if they are not marked as a kit component.

<apex:page standardController="Order" renderAs="pdf">
<div style="font-family:sans-serif; font-size:12px; width: 100%; float: left; box-sizing: border-box;">
    <div style="float: left; width: 100%; margin-bottom: 20px;">
        <div style="float: left; width: 50%;">
            <apex:image url="{!$Resource.Logo}" rendered="true" width="200" height="35" />


    <div style="float: left; width: 100%;">
        <div style="float: left; width: 50%;">
            <div style="float: left; width: 100%; margin: 5px 0;">
                <div style="float: left; text-align: right; width: 35%; font-weight: bold;">
                    <apex:outputText value="Order #"></apex:outputText>
                </div>
                <div style="float: right; width: 63%; margin-left: 2%;">
                    <apex:outputText value="{!Order.OrderNumber}"></apex:outputText>
                </div>
            </div>

            <div style="float: left; width: 100%; margin: 5px 0;">
                <div style="float: left; text-align: right; width: 35%; font-weight: bold;">
                    <apex:outputText value="Sales Rep"></apex:outputText>
                </div>
                <div style="float: right; width: 63%; margin-left: 2%;">
                    <apex:outputText value="{!Order.Sales_Team_Member__c}"></apex:outputText>
                </div>
            </div>

            <div style="float: left; width: 100%; margin: 5px 0;">
                <div style="float: left; text-align: right; width: 35%; font-weight: bold;">
                    <apex:outputText value="Hospital Name"></apex:outputText>
                </div>
                <div style="float: right; width: 63%; margin-left: 2%;">
                    <apex:outputText value="{!Order.CustomerName__c}"></apex:outputText>
                </div>
            </div>

            <div style="float: left; width: 100%; margin: 5px 0;">
                <div style="float: left; text-align: right; width: 35%; font-weight: bold;">
                    <apex:outputText value="Billing Contact"></apex:outputText>
                </div>
                <div style="float: right; width: 63%; margin-left: 2%;">
                    <apex:outputText value="{!Order.BillToContact.Name}"></apex:outputText>
                </div>
            </div>

            <div style="float: left; width: 100%; margin: 5px 0;">
                <div style="float: left; text-align: right; width: 35%; font-weight: bold;">
                    <apex:outputText value="Billing Address"></apex:outputText>
                </div>
                <div style="float: right; width: 63%; margin-left: 2%;">
                    <apex:outputPanel rendered="{!IF(Order.BillingStreet == null, false, true)}"> 
                        <apex:outputText value="{!Order.BillingStreet}"></apex:outputText><br/>
                    </apex:outputPanel>
                    <apex:outputPanel rendered="{!IF(Order.BillingCity == null, false, true)}"> 
                        <apex:outputText value="{!Order.BillingCity}"></apex:outputText>
                    </apex:outputPanel>
                    <apex:outputPanel rendered="{!IF(Order.BillingState == null, false, true)}"> 
                        <apex:outputText value=", {!Order.BillingState}"></apex:outputText>
                    </apex:outputPanel>
                    <apex:outputPanel rendered="{!IF(Order.BillingPostalCode == null, false, true)}"> 
                        <apex:outputText value=" {!Order.BillingPostalCode}"></apex:outputText>
                    </apex:outputPanel>
                    <apex:outputPanel rendered="{!IF(Order.BillingCountry == null, false, true)}"><br/> 
                        <apex:outputText value="{!Order.BillingCountry}"></apex:outputText><br/>
                    </apex:outputPanel>
                </div>
            </div>
        </div>

        <div style="float: left; width: 50%;">
            <div style="float: left; width: 100%; margin: 5px 0;">
                <div style="float: left; text-align: right; width: 35%; font-weight: bold;">
                    <apex:outputText value="Order Date"></apex:outputText>
                </div>
                <div style="float: right; width: 63%; margin-left: 2%;">
                    <apex:outputText value="{0,date,MM/dd/yyyy}"> 
                        <apex:param value="{!Order.EffectiveDate}" />
                    </apex:outputText>
                </div>
            </div>

            <div style="float: left; width: 100%; margin: 5px 0;">
                <div style="float: left; text-align: right; width: 35%; font-weight: bold;">
                    <apex:outputText value="PO #"></apex:outputText>
                </div>
                <div style="float: right; width: 63%; margin-left: 2%;">
                    <apex:outputText value="{!Order.PoNumber}"></apex:outputText>
                </div>
            </div>

            <div style="float: left; width: 100%; margin: 5px 0;">
                <div style="float: left; text-align: right; width: 35%; font-weight: bold;">
                    <apex:outputText value="Shipping Method"></apex:outputText>
                </div>
                <div style="float: right; width: 63%; margin-left: 2%;">
                    <apex:outputText value="{!Order.Shipping_Method__c}"></apex:outputText>
                </div>
            </div>
            <div style="float: left; width: 100%; margin: 5px 0;">
                <div style="float: left; text-align: right; width: 35%; font-weight: bold;">
                    <apex:outputText value="Shipping Contact"></apex:outputText>
                </div>
                <div style="float: right; width: 63%; margin-left: 2%;">
                    <apex:outputText value="{!Order.ShipToContact.Name}"></apex:outputText>
                </div>
            </div>
            <apex:outputPanel rendered="{!IF(Order.Shipping_Account__c == null, false, true)}">    
                <div style="float: left; width: 100%; margin: 5px 0;">
                    <div style="float: left; text-align: right; width: 35%; font-weight: bold;">
                        <apex:outputText value="Shipping Account #"></apex:outputText>
                    </div>
                    <div style="float: right; width: 63%; margin-left: 2%;">
                        <apex:outputText value="{!Order.Shipping_Account__c}"></apex:outputText>
                    </div>
                </div>
            </apex:outputPanel> 

            <div style="float: left; width: 100%; margin: 5px 0;">
                <div style="float: left; text-align: right; width: 35%; font-weight: bold;">
                    <apex:outputText value="Shipping Address"></apex:outputText>
                </div>
                <div style="float: right; width: 63%; margin-left: 2%;">
                    <apex:outputPanel rendered="{!IF(Order.ShippingStreet == null, false, true)}"> 
                        <apex:outputText value="{!Order.ShippingStreet}"></apex:outputText><br/>
                    </apex:outputPanel>
                    <apex:outputPanel rendered="{!IF(Order.ShippingCity == null, false, true)}"> 
                        <apex:outputText value="{!Order.ShippingCity}"></apex:outputText>
                    </apex:outputPanel>
                    <apex:outputPanel rendered="{!IF(Order.ShippingState == null, false, true)}"> 
                        <apex:outputText value=", {!Order.ShippingState}"></apex:outputText>
                    </apex:outputPanel>
                    <apex:outputPanel rendered="{!IF(Order.ShippingPostalCode == null, false, true)}"> 
                        <apex:outputText value=" {!Order.ShippingPostalCode}"></apex:outputText>
                    </apex:outputPanel>
                    <apex:outputPanel rendered="{!IF(Order.ShippingCountry == null, false, true)}"><br/> 
                        <apex:outputText value="{!Order.ShippingCountry}"></apex:outputText><br/>
                    </apex:outputPanel>                     
                </div>
            </div>
        </div>
    </div>
    <div style="clear: both;"></div>

    <div style="float: left; width: 100%; margin-top: 30px;">

       <apex:datatable style="width: 100%;" styleClass="tableClass" value="{!Order.OrderItems}"  var="or" rendered =  "{!Order.OrderItems.Kit_Component__c=false }" id="theTable" columnswidth="40%, 15%, 10%, 15%, 20%"> 
            <apex:column style="padding: 5px; width: 40%;" value="{!or.PriceBookEntry.Product2.Name}">
                <apex:facet name="header"> 
                    <apex:outputText style="padding: 5px; background-color: #454545; color:#fff; margin-bottom: 10px; width: 98%; float: left; border-bottom: 1px solid #000;" value="Item Name"> </apex:outputText>
                </apex:facet>
            </apex:column>

            <apex:column style="padding: 5px; width: 15%;" value="{!or.PriceBookEntry.Product2.ProductCode}">
                <apex:facet name="header">
                    <apex:outputText style="padding: 5px; background-color: #454545; color:#fff; margin-bottom: 10px; width: 96%; float: left; border-bottom: 1px solid #000;" value="Item Code"></apex:outputText>
                </apex:facet>
            </apex:column>

            <apex:column style="padding: 5px; width: 10%;" value="{!or.UOM__c}">
                <apex:facet name="header">
                    <apex:outputText style="padding: 5px; background-color: #454545; color:#fff; margin-bottom: 10px; width: 90%; float: left; border-bottom: 1px solid #000;" value="UOM"></apex:outputText>
                </apex:facet>
            </apex:column>

            <!--  <apex:column style="padding: 5px; width: 15%;" value="{!or.PO_Quantity__c}">
                <apex:facet name="header">
                    <apex:outputText style="padding: 5px; background-color: #454545; color:#fff; margin-bottom: 10px; width: 90%; float: left; border-bottom: 1px solid #000;" value="PO Quantity"></apex:outputText>
                </apex:facet>
            </apex:column> -->

            <apex:column style="padding: 5px; width: 20%;" value="{!or.Quantity}">
                <apex:facet name="header">
                    <apex:outputText style="padding: 5px; background-color: #454545; color:#fff; margin-bottom: 10px; width: 96%; float: left; border-bottom: 1px solid #000;" value="Shipped Quantity"></apex:outputText>
                </apex:facet>
            </apex:column>

        </apex:datatable>

        <div style="float: left; width: 100%; border-top: 1px solid #ddd; padding: 5px 0; margin-top: 5px;"></div>
    </div>

    <div style="float: left; width: 100%; margin-top: 40px;">
        <p style="margin-bottom: 20px; line-height: 22px; letter-spacing: 1px;"><strong>Shipping - Delivery Instructions</strong></p>
        <p style="line-height: 18px; letter-spacing: 1px;">{!Order.Shipping_Delivery_Instructions__c}</p>
    </div>
    <apex:outputPanel rendered="{!IF(Order.Account.Shipping_Documents_Needed__c == null, false, true)}"> 
        <div style="float: left; width: 100%; margin-top: 40px;">
            <p style=""><strong>Shipping Documents Needed</strong></p> <!-- margin-bottom: 20px; line-height: 22px; letter-spacing: 1px;-->
            <p style="">{!Order.Account.Shipping_Documents_Needed__c}</p> <!-- line-height: 18px; letter-spacing: 1px; -->
        </div>
    </apex:outputPanel>
</div>
<div style="clear: both;"></div>

  • Welcome to SFSE! It seems like you're trying to use Order.OrderItems.Kit_Component__c while iterating over the Order.OrderItems in same loop (apex:datatable). Don't think that can be done just inside a visualforce page, you may need to write a controller extension for the page to compute a Boolean property returning products in a table if they are not marked as a kit component. – Raul Jan 7 at 15:47
2

You are referencing a property that presumably belongs to a single OrderItem in a value that is a List<OrderItem>:

rendered =  "{!Order.OrderItems.Kit_Component__c=false }" 

That's not going to work in this context. If you want to filter the list of OrderItems, you will need to either:

  • Change the way the data table is built to use an <apex:repeat> component, where you can include conditional rendering against each line item individually.
  • Write a custom Apex controller instead of using the standard controller here, and source the relevant Order Items using a filtered SOQL query.

There isn't an option that does not involve writing code at some level (Visualforce is code!). There are some good Trailhead modules that can walk you through the basics of building Visualforce pages and controllers, but fundamentally, this is a development activity and you'll need to either dig into the code or work with someone who has experience writing Visualforce and/or Apex.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.