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
bingi crm 7bingi crm 7 

Unknown property 'OpportunityLineItemStandardController.OppList' vf page showing error

visual force page
<apex:page standardController="OpportunityLineItem" extensions="Displayprods1">
    <apex:form>
    <apex:pageBlock>
        <apex:repeat value="{!OppList}" var="a">
            <apex:inputText  value="{!a.name}"/>
            <apex:inputText  value="{!a.Quantity}"/>
            <apex:inputText  value="{!a.ListPrice}"/>
            <apex:inputText  value="{!a.nameTotalPrice}"/>
        </apex:repeat>
    </apex:pageBlock> 
    </apex:form>
</apex:page>

class controller
public class Displayprods1
{
    public List<OpportunityLineItem> proList{get;set;}
    List<OpportunityLineItemwrapper> OppList  {get;set;}
    public Displayprods1(ApexPages.StandardController controller)
    {
        OppList = new List<OpportunityLineItemwrapper>();
    }
    public OpportunityLineItem[] getOpportunityLineItemlist() {
        return [select id,Quantity,ListPrice,TotalPrice from OpportunityLineItem limit10];
        
    }
    public void populate()
    {
        list<OpportunityLineItem > plist = [select id,Quantity,ListPrice,TotalPrice from OpportunityLineItem limit10];
        for(OpportunityLineItem pr:plist)
        {
            OpportunityLineItemwrapper w1 = new OpportunityLineItemwrapper();
            w1.name = pr.name;
            w1.Quantity = Integer.valueOf(pr.Quantity);
            w1.ListPrice = pr.ListPrice;
            w1.TotalPrice = pr.TotalPrice;
            OppList.add(w1);
        }
    }
}
wrapper class
public class OpportunityLineItemwrapper {
// all the line record instance create
        public OpportunityLineItem pro{get; set;} 
        public  string name {get;set;}
        public  integer Quantity {get;set;} // number
        public  decimal ListPrice {get;set;} // currency
        public  decimal TotalPrice {get;set;} // currency 
        public  Boolean selected {get; set;} // true
        public OpportunityLineItemwrapper()
        {      
               name  = '';
               Quantity = 0;
               ListPrice = 0 ;
               TotalPrice = 0;
        }
     
}
Amit Chaudhary 8Amit Chaudhary 8
Please update your code like  below
public class Displayprods1
{
    public List<OpportunityLineItem> proList{get;set;}
    public List<OpportunityLineItemwrapper> OppList  {get;set;}
    public Displayprods1(ApexPages.StandardController controller)
    {
        OppList = new List<OpportunityLineItemwrapper>();
		populate();
    }
    public OpportunityLineItem[] getOpportunityLineItemlist() {
        return [select id,Quantity,ListPrice,TotalPrice from OpportunityLineItem limit10];
        
    }
    public void populate()
    {
        list<OpportunityLineItem > plist = [select id,Quantity,ListPrice,TotalPrice from OpportunityLineItem limit10];
        for(OpportunityLineItem pr:plist)
        {
            OpportunityLineItemwrapper w1 = new OpportunityLineItemwrapper();
            w1.name = pr.name;
            w1.Quantity = Integer.valueOf(pr.Quantity);
            w1.ListPrice = pr.ListPrice;
            w1.TotalPrice = pr.TotalPrice;
            OppList.add(w1);
        }
    }
}

Let us know if this will help you

Thanks
Amit Chaudhary
bingi crm 7bingi crm 7
Unknown property 'OpportunityLineItemStandardController.OppList' same issue
bingi crm 7bingi crm 7
public class Displayprods1 { public List proList{get;set;} public List OppList {get;set;} public Displayprods1(ApexPages.StandardController controller) { OppList = new List(); populate(); } public OpportunityLineItem[] getOpportunityLineItemlist() { return [select id,Quantity,ListPrice,TotalPrice from OpportunityLineItem limit10]; } public void populate() { list plist = [select id,Quantity,ListPrice,TotalPrice from OpportunityLineItem limit10]; for(OpportunityLineItem pr:plist) { OpportunityLineItemwrapper w1 = new OpportunityLineItemwrapper(); w1.name = pr.name; w1.Quantity = Integer.valueOf(pr.Quantity); w1.ListPrice = pr.ListPrice; w1.TotalPrice = pr.TotalPrice; OppList.add(w1); } } }
bingi crm 7bingi crm 7
sorry it not dispaly on vf page
bingi crm 7bingi crm 7
code is working on class but vf page is not showing the values
Amit Chaudhary 8Amit Chaudhary 8
I just tested your code in my dev org. Please update your code like below

Apex class
public class Displayprods1
{
    public List<OpportunityLineItem> proList{get;set;}
    public List<OpportunityLineItemwrapper> OppList  {get;set;}
    public Displayprods1(ApexPages.StandardController controller)
    {
        OppList = new List<OpportunityLineItemwrapper>();
        populate();
    }
    public OpportunityLineItem[] getOpportunityLineItemlist() {
        return [select id,Quantity,ListPrice,TotalPrice,Name  from OpportunityLineItem limit10];
        
    }
    public void populate()
    {
        list<OpportunityLineItem > plist = [select id,Quantity,ListPrice,TotalPrice,Name   from OpportunityLineItem limit10];
        for(OpportunityLineItem pr:plist)
        {
            OpportunityLineItemwrapper w1 = new OpportunityLineItemwrapper();
            w1.name = pr.name;
            w1.Quantity = Integer.valueOf(pr.Quantity);
            w1.ListPrice = pr.ListPrice;
            w1.TotalPrice = pr.TotalPrice;
            OppList.add(w1);
        }
    }
}
Page like below
<apex:page standardController="OpportunityLineItem" extensions="Displayprods1">
    <apex:form >
    <apex:pageBlock >
    <!--
        <apex:repeat value="{!OppList}" var="a">
            <apex:inputText value="{!a.name}"/>
            <apex:inputText value="{!a.Quantity}"/>
            <apex:inputText value="{!a.ListPrice}"/>
            <apex:inputText value="{!a.TotalPrice}"/>
        </apex:repeat>
    -->
    
        <apex:pageBlockTable value="{!OppList}" var="a">
            <apex:column value="{!a.name}" headerValue="Name"/>        
            <apex:column value="{!a.Quantity}" headerValue="Quantity"/>
            <apex:column value="{!a.ListPrice}" headerValue="ListPrice"/>
            <apex:column value="{!a.TotalPrice}" headerValue="TotalPrice"/>
        
        </apex:pageBlockTable>    
        
    </apex:pageBlock> 
    </apex:form>
</apex:page>

User-added image

NOTE:- please create opportunity with product line item then check above code

Please let us know if this will help you
 
bingi crm 7bingi crm 7
System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: OpportunityLineItem.Name Class.Displayprods1.populate: line 20, column 1 Class.Displayprods1.: line 8, column 1
bingi crm 7bingi crm 7
i am try another format also Visualforce Error Help for this Page Unknown property 'OpportunityLineItemStandardController.OppList' Error is in expression '{!OppList}' in component in page product1
bingi crm 7bingi crm 7
ok i will take care of this . Thank you for supporting me
bingi crm 7bingi crm 7
This is class i can chage the little bit of code but they are not showing the vf page i am using inputfield to get the values can you please find out the error public class Displayprods1{ public List proList{get;set;} public List OppList {get;set;} public final Opportunity objOpportunity; public Displayprods1(ApexPages.StandardController controller) { OppList = new List(); this.objOpportunity = (Opportunity) controller.getRecord(); } public void populate() { list plist = [select id,Name, Quantity,ListPrice,TotalPrice from OpportunityLineItem where OpportunityId=:objOpportunity.Id limit 10]; for(OpportunityLineItem pr:plist) { OpportunityLineItemwrapper w1 = new OpportunityLineItemwrapper(); w1.name = pr.name; w1.Quantity = Integer.valueOf(pr.Quantity); w1.ListPrice = pr.ListPrice; w1.TotalPrice = pr.TotalPrice; OppList.add(w1); } } } wrapper class public class OpportunityLineItemwrapper { // all the line record instance create public OpportunityLineItem pro{get; set;} public string name {get;set;} public integer Quantity {get;set;} // number public decimal ListPrice {get;set;} // currency public decimal TotalPrice {get;set;} // currency public Boolean selected {get; set;} // true public OpportunityLineItemwrapper() { name = ''; Quantity = 0; ListPrice = 0 ; TotalPrice = 0; } } visual force page