1

I have created a vf page on "Quote" object .Now i would like to get the fields of custom object "Opportunity Forecast " API name as :gmod__Opportunity_Forecast__c , is a installed package . This custom object does not have any relation ship with quote object .How to get the fields of this custom object in vf page .But when i refer them the system throws an

Error as :Unknown property 'QuoteStandardController.gmod__Opportunity_Forecast__c'

Is that i'm making any blunt mistakes in my code .Any help is very much appreciated.

<h2>OpportunityForecast Details</h2>
 <table class="bordered">
        <thead>
            <tr>
                <td class="header-table-heading" bgcolor="#C0C0C0"> Part Numbers</td>
                <td class="header-table-heading" bgcolor="#C0C0C0">Quantity</td>
                <td class="header-table-heading" bgcolor="#C0C0C0">Price</td>
            </tr>
        </thead>
        <tbody>
            <apex:repeat value="{!gmod__Opportunity_Forecast__c}" var="opf">
            <tr>
                <td class="header-table-data"><apex:outputText value="{!gmod__Opportunity_Forecast__c.gmod__Product__c}"/></td>
                <td class="header-table-data"><apex:outputText value="{!gmod__Opportunity_Forecast__c.gmod__Quantity__c}"/></td>
                <td class="header-table-data"><apex:outputField value="{!gmod__Opportunity_Forecast__c.gmod__Price__c }"/></td>
             </tr>
            </apex:repeat>
        </tbody>
    </table> 

Apex Class :

public with sharing class QuoteContentController {

      public List<wrapperClass> disp_list {get;set;}
          List<wrapperClass> disp_list1 {get;set;} 
          List<wrapperClass>disp_list2 {get;set;} 
          List<wrapperClass>disp_list3 {get;set;}              
    public gmod__Opportunity_Forecast__c opf{get;set;}


    public Id qId {get;set;}

    public QuoteContentController(ApexPages.StandardController controller) {
    qId=Apexpages.currentPage().getparameters().get('Id');

    }

    public QuoteContentController(){

     list<Quote> q =[select id ,Name ,Effective_Date__c ,Comments__c ,
                    Quote.Opportunity.Probability ,Quote.Opportunity.AccSegment__c ,Quote.Opportunity.AccApplication__c,Quote.Opportunity.Persona__c,Quote.Opportunity.Region__c
                    from Quote where id=:apexpages.currentpage().getparameters().get('id')];

       // Wrapper for Quote Line Items             

               public List<wrapperClass> getdisp_list(){
             wrapperClass tempObj ;
              tempObj = new wrapperClass();
             List<wrapperClass> aReList = new List<wrapperClass>();             

         list<QuoteLineItem> qli =[Select QuoteId , PricebookEntry.Product2.Name ,Unitprice ,End_Customer_Price__c ,Quantity , TotalPrice from QuoteLineItem where QuoteId =:qId ];

              for(integer i=0; i < qli.size(); i++)
                   {
                     tempObj = new wrapperClass();
                     tempObj.Name= qli[i].PricebookEntry.Product2.Name;
                     tempObj.quantity=qli[i].Quantity;
                     tempObj.Total=qli[i].TotalPrice;
                     tempObj.Price=qli[i].ListPrice;
                     tempobj.End_Customer_Price=qli[i].End_Customer_Price__c;


                     if(tempobj!=null){
                        aReList.add(tempObj);
                     }
                    }
           return aReList;
   }


      // Wrapper for Account
    public List<wrapperClass> getdisp_list1 (){
               wrapperClass tempObj1 ;
               tempObj1 = new wrapperClass();
               List<wrapperClass> aReList1 = new List<wrapperClass>();

    list<Account> a = [Select id ,Name ,Main_Customers_of_Account__c ,Bridgelux_Competition_at_Account__c,Servicing_Region__c ,
                      Annual_LED_Revenue__c,Annual_Purchases_of_LED_Sources_SAM__c ,Percent_of_LED_purchases_that_are_COB__c from Account where account.id =:qId ];

                      for(integer i=0; i < a.size(); i++)
                   {
                     tempObj1 = new wrapperClass();
                     tempObj1.name= a[i].Name;
                     tempObj1.Main_Customers_of_Account=a[i].Main_Customers_of_Account__c;
                     tempObj1.Bridgelux_Competition_at_Account=a[i].Bridgelux_Competition_at_Account__c;
                     tempObj1.Geographic_regions_serviced=a[i].Servicing_Region__c;
                     tempobj1.Annual_lighting_revenue=a[i]. Annual_LED_Revenue__c;
                     tempobj1.Annual_Purchases_of_LED_Sources_SAM=a[i].Annual_Purchases_of_LED_Sources_SAM__c;


                     if(tempobj1!=null){
                        aReList1.add(tempObj1);
                     }
                    }
           return aReList1;
   }

       // Wrapper for Competitor
     public List<wrapperClass> getdisp_list2 (){
               wrapperClass tempObj2 ;
               tempObj2 = new wrapperClass();
               List<wrapperClass> aReList2 = new List<wrapperClass>();

     list<Competitor__c>  com = [Select id ,Part_Number__c,Product_Series__c,Price_Offered__c,Volume__c,Date_Price_is_Valid__c from Competitor__c  where Competitorid=:qId]  ; 

    for(integer i=0; i < com.size(); i++)
                   {
                     tempObj2 = new wrapperClass();
                     tempObj2.Part_Number= com[i].Part_Number__c;
                     tempObj2.Product_Series=com[i].Product_Series__c;
                     tempObj2.Price_Offered=com[i].Price_Offered__c;
                     tempObj2.Volume=com[i].Volume__c;
                     tempobj2.Date_Price_is_Valid=com[i].Date_Price_is_Valid__c;

                     if(tempobj2!=null){
                        aReList2.add(tempObj2);
                     }
                    }
           return aReList2;
   }


      // Wrapper for forecast
     public List<wrapperClass> getdisp_list3 (){
               wrapperClass tempObj3 ;
               tempObj3 = new wrapperClass();
               List<wrapperClass> aReList3 = new List<wrapperClass>();
     list<gmod__Opportunity_Forecast__c>  opf = [Select id ,gmod__Product__c,gmod__Quantity__c,gmod__Price__c from gmod__Opportunity_Forecast__c  where createddate!=null order by name limit 1 ];          

    for(integer i=0; i < opf.size(); i++)
                   {
                     tempObj3 = new wrapperClass();
                     tempObj3.gmod__Product= opf[i].gmod__Product__c;
                     tempObj3.gmod__Quantity=opf[i].gmod__Quantity__c;
                     tempObj3.gmod__Price=opf[i].gmod__Price__c;


                     if(tempobj3!=null){
                        aReList3.add(tempObj3);
                     }
                    }
           return aReList3;
   }


     //Declare a wrapper class  

     public class Wrapperclass{


      public Competitor__c comp{get;set;}
      public gmod__Opportunity_Forecast__c off{get;set;}

    //custom wrapper datatype  

      public string Name{get;set;}  
      public string AccountType{get;set;}  
      public date todaysDate{get;set;}  
      public date Expected_Order_Date{get;set;}
      public string Probability{get;set;}  
      public string Internal_Comment{get;set;}  
      public string External_Comment{get;set;}  
      public string Segment{get;set;}  
      public string Application{get;set;}  
      public string Persona{get;set;}  
      public string Geogrpahy{get;set;}  
      public string Handoff_Attached{get;set;}  
      public string PartNumbers{get;set;}  
      public Decimal  Price{get;set;}  
      public Decimal End_Customer_Price{get;set;}  
      public Decimal Quantity {get;set;}  
      public Decimal Total{get;set;}  
      public string RFQ_justification{get;set;}  
      public string Main_Customer_of_Account{get;set;}  
      public string Bridgelux_competition_at_account{get;set;}

      public string Geographic_regions_serviced{get;set;}  
      public string Annual_lighting_revenue{get;set;}  
      public string Annual_LED_revenue_or_percent{get;set;}  
      public string Annual_purchases_of_LED_light_sources{get;set;}
      public string Percent_of_LED_purchases_that_are_COB{get;set;}  
      public string Other_information{get;set;}  
      public string Product_Series{get;set;}  
      public string Volume{get;set;} 
      public string Date_Price_is_Valid{get;set;}
      public wrapperClass(){}     
    }

}
1
  • Where is this defined gmod__Opportunity_Forecast__c? Apr 19, 2016 at 6:28

1 Answer 1

1

your <apex:repeat> is not correct. Instead of calling gmod__Opportunity_Forecast__c you need to call disp_list3 because this returns the list of gmod__Opportunity_Forecast__c objects. Then in the tds use opf. gmod__Product__c and so on in order to read the attributes of each entry in the list that disp_list3 returns.

    <apex:repeat value="{!disp_list3}" var="opf">
    <tr>
        <td class="header-table-data"><apex:outputText value="{!opf.gmod__Product__c}"/></td>
        <td class="header-table-data"><apex:outputText value="{!opf.gmod__Quantity__c}"/></td>
        <td class="header-table-data"><apex:outputField value="{!opf.gmod__Price__c }"/></td>
     </tr>
    </apex:repeat>

i hope this helps.

6
  • :I have written a controller extension class already ,but still i do get error.
    – nikkey
    Dec 15, 2014 at 11:22
  • As far as i understand your controller right, my Code should work. Dec 15, 2014 at 13:43
  • :I get an Error as: QuoteContentController Compile Error: expecting a semi-colon, found '(' at line 26 column 53.at public List<wrapperClass> getdisp_list(){.
    – nikkey
    Dec 15, 2014 at 17:37
  • line 26 in your posted code is a comment
    – cropredy
    Dec 16, 2014 at 3:15
  • @crop1645: i have removed all the comments and executed. got the error
    – nikkey
    Dec 16, 2014 at 9:25

You must log in to answer this question.

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