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
Andrew Aldis 6Andrew Aldis 6 

Invalid Type Controller Help

I am working on a controller that will allow me to only show child records that have a shipdate populated.  The situation is this I am creating a VF page with 3 sets of information involving 1 parent object and 2 of that parents child objects.  We have an installation object that is used by project managers to track project information we want to show all hardware related to the installation and all serial numbers which have been shipped to the customer which is also related to the object.  I am currently using a Rendered If formula on the pageblockTable to show shipped serial numbers but it looks sloppy on the PDF.  I am trying to create a simple controller to pull serial numbers that have a ship date that is not null.  So the situation is this the Installation parent object is SFDC_Project__c, and the Serial Number Child object is Serial_Numbers__r, the hardware object is working fine. 

Here is my class, I keep getting an error that says Invalid Type: installs.  I am not a developer but am trying to learn I can us VF with standard controllers but want to figure out extensions and other controllers. 

public with sharing class hardwareShippingSerialNumbers {

    public List<SFDC_Project__c> installs { get; set; }
    
   
    /**
     * Name: Parameterised Constructor
     * Desc: To initialize values
    **/
   public hardwareShippingSerialNumbers(ApexPages.StandardSetController controller)
    {
        // To get the install record
        installs ins = (installs)stdController.getRecord();
        
        if( ins != null )
        {
           installs = [ Select Id,
                            (SELECT  Id, Installation__c, SCMC__Serial_Number__c, Shipment_Date_Time__c, Warranty_Level__c,
                            Warranty_Expiration_Date1__c FROM Serial_Numbers__r  Where Shipment_Date_Time__c!=Null)
                            FROM SFDC_Project__c ];
        }
    }}
Vishal_GuptaVishal_Gupta
Hi Andrew,

Please try below code:

public with sharing class hardwareShippingSerialNumbers {

     public List<SFDC_Project__c> listOfinstalls { get; set; }
     public SFDC_Project__c install { get; set; }
    
   
    /**
     * Name: Parameterised Constructor
     * Desc: To initialize values
    **/
   public hardwareShippingSerialNumbers(ApexPages.StandardSetController controller)
    {
        // To get the install record
        install  = (SFDC_Project__c )stdController.getRecord();
        
        if( install  != null )
        {
           listOfinstalls = [ Select Id,
                            (SELECT  Id, Installation__c, SCMC__Serial_Number__c, Shipment_Date_Time__c, Warranty_Level__c,
                            Warranty_Expiration_Date1__c FROM Serial_Numbers__r  Where Shipment_Date_Time__c!=Null)
                            FROM SFDC_Project__c ];
        }
    }}

Please let me know if I can help you in any way.

Thanks,
Vishal
Andrew Aldis 6Andrew Aldis 6

The class itself seems to be right it saved without a problem but when ever I try to plug it into my VF page I get the following error:
common.apex.runtime.bytecode.BytecodeApexObjectType cannot be cast to common.apex.runtime.impl.ApexType

Here is my page.

<apex:page standardController="SFDC_Project__c" extensions="hardwareShippingSerialNumbers" sidebar="false" renderAs="PDF" >

    <apex:image url="{!$Resource.FWiLogo}"/> <br/><Br/>
    <center>
        <h1 style="font-size:20pt">
        Installation Shipping Information
        </h1>
    </center>
    <apex:pageBlock >

        <b >Account:</b> <b></b> <apex:outputField value=" {! SFDC_Project__c.Account_Name__c }" /><br/>
        <b >Installation:</b> <b></b><apex:outputField value=" {! SFDC_Project__c.Name }" /><br/>
        <b >Project Name:</b> <b></b><apex:outputField value=" {! SFDC_Project__c.SFDC_Project_Name__c }" /><br/>
        <b >Project Manager:</b> <b></b><apex:outputField value=" {! SFDC_Project__c.Project_Manager_Name__c}" /><br/>
    </apex:pageBlock>
           <apex:pageBlock >
        <h6>
            Hardware Shipping Information
        </h6>
                <apex:pageBlockTable value="{!SFDC_Project__c.Hardware_Information__r}" var="hardware" title="Hardware Shipping Information" style="font-size:8pt" width="100%" >
                  <apex:column headerValue="Ship Date" width="50pt"><apex:outputField value="{!hardware.Ship_Date__c}"  /></apex:column>
                  <apex:column headerValue="Item" width="90pt"><apex:outputField value="{!hardware.Item_Name__c}"  /></apex:column>                 
                  <apex:column headerValue="Quantity Ordered"  width="50pt" ><apex:outputField value="{!hardware.Quantity_Ordered__c}" /></apex:column>
                  <apex:column headerValue="Quantity Shipped" width="50pt"><apex:outputField value="{!hardware.Quantity_Shipped__c}"  /></apex:column>
                  <apex:column headerValue="Carrier" width="50pt"><apex:outputField value="{!hardware.Carrier_for_Shipment__c}"  /></apex:column>
                  <apex:column headerValue="Drop Ship Supplier Site" width="110pt"><apex:outputField value="{!hardware.Supplier_Site_Drop_Ship_Hardware__c}"  /></apex:column>
                  <apex:column headerValue="Tracking Number" width="95pt"><apex:outputField value="{!hardware.Tracking_Number__c}"  /></apex:column>
                  <apex:column headerValue="Address" width="145pt"><apex:outputField value="{!hardware.Ship_to_Address__c}"  /></apex:column>
                </apex:pageBlockTable>
        </apex:pageBlock>
    <apex:pageBlock >
 
        <h6>
            Drop Shipped Serial Numbers
        </h6>
                 <apex:pageBlockTable value="{!SFDC_Project__c.Hardware_Information__r}" var="hardware" title="Hardware Shipping Information" style="font-size:8pt" width="100%">
                  <apex:column headerValue="Item" width="90pt"><apex:outputField value="{!hardware.Item_Name__c}" /></apex:column>
                  <apex:column headerValue="Drop Shipped Serial Numbers" width="200pt"><apex:outputField value="{!hardware.Serial_Number_Shipped_from_Denver_Whs__c}" /></apex:column>
                  <apex:column headerValue="Quantity Shipped" width="50pt"><apex:outputField value="{!hardware.Quantity_Shipped__c}" /></apex:column>
                  <apex:column headerValue="Carrier" width="50pt"><apex:outputField value="{!hardware.Carrier_for_Shipment__c}" /></apex:column>
                  <apex:column headerValue="Drop Ship Supplier Site"  width="110pt"><apex:outputField value="{!hardware.Supplier_Site_Drop_Ship_Hardware__c}"/></apex:column>
                   <apex:column headerValue="Tracking Number" width="100pt"><apex:outputField value="{!hardware.Tracking_Number__c}" /></apex:column>
                </apex:pageBlockTable>
    </apex:pageBlock>
  <apex:pageBlock >
        <h6>
            Serial Numbers Shipped from Huron
        </h6>
                <apex:pageBlockTable value="{!SFDC_Project__c.Serial_Numbers__r}" var="sn" title="Serial Numbers Shipped from Huron" style="font-size:8pt" width="100%">
                  <apex:column headerValue="Item" width="100pt"><apex:outputField value="{!sn.Item_Name__c}"  /></apex:column>
                  <apex:column headerValue="Serial Number" width="100pt"><apex:outputField value="{!sn.SCMC__Serial_Number__c}"  /></apex:column>
                  <apex:column headerValue="Ship Date" width="100pt"><apex:outputField value="{!sn.Shipment_Date_Time__c}"  /></apex:column>
                  <apex:column headerValue="Warranty Level" width="100pt"><apex:outputField value="{!sn.Standard_Warranty_Levels__c}"  /></apex:column>
                  <apex:column headerValue="Warranty Expiration Date" width="100pt"><apex:outputField value="{!sn.Warranty_Expiration_Date1__c}"  /></apex:column>
                </apex:pageBlockTable>            
    </apex:pageBlock>       
</apex:page>

Vishal_GuptaVishal_Gupta
Hi Andrew,

Is it poosible for you to share your org with me for few hours, I can check your code and will try to fix it.

You can contact me on my email vishal.er.gupta@gmail.com

Thanks,
Vishal
Vishal_GuptaVishal_Gupta
Hi Andrew,

Any luck or still stuck with same issue?

Thanks,
Vishal