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
newcloudcodernewcloudcoder 

Invalid type 'Lineitems'..pls help urgent

public with sharing class BillingCloseController {
   
    public String StatusText;
    public String LineItems;
   
   
    public List<OpportunityLineitem> Olilist;
    Boolean InsertFlag;
   
    public Billing_Close__c BC;
    public BillingCloseController(ApexPages.StandardController stdController) {
        this.BC = (Billing_Close__c) stdController.getRecord();
    }
       
     // Fill list with Forecasts
   
    public List<OpportunityLineItem> BillingList(){
        List<LineItems> bl;
        try {
           bl = [Select Opportunity.Name, Opportunity.Account.Name,PricebookEntry.Product2.Name, PricebookEntry.Product2.Product__r.Name, Edition__c, Quantity, ServiceDate, UnitPrice, TotalPrice
                from OpportunityLineItem];
               return LineItems;
               
        } catch (QueryException e){
            system.debug(e.getMessage());
            StatusText = e.getMessage();
        }
}
}

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

In this section:

 

        List<LineItems> bl;
        try {
           bl = [Select Opportunity.Name, Opportunity.Account.Name,PricebookEntry.Product2.Name, PricebookEntry.Product2.Product__r.Name, Edition__c, Quantity, ServiceDate, UnitPrice, TotalPrice
                from OpportunityLineItem];
               return LineItems;

You have declared a list of LineItems, but this isn't a valid type - should this be List<OpportunityLineItem>?

 

You are also not returning the values you have queried - I reckon you should be returning as follows.

 

               return bl;

 However, you are also