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 

i am write the wrapper class on OpportunityLineItem they are not showing the records this is my class

public class Displayprods
{

 //This is where we have defined the Wrapper Class. 
    public class OpportunityLineItemwrapper
    {
      // all the line record instance create
        public OpportunityLineItem prd{get; set;}
        public Boolean selected {get; set;}
        public OpportunityLineItemwrapper(OpportunityLineItem a)
        {
            prd = a;
            selected = false;
        }
    }
 // This is the Wrapper Name for the object Opportunity Line Items
    List<OpportunityLineItemwrapper> OppList = new List<OpportunityLineItemwrapper>();
    List<OpportunityLineItem> selectedProducts = new List<OpportunityLineItem>();

 //Defines a Map to store all items selected based on the ID from the  ID from the URl.
    Map<Id,OpportunityLineItem> selectedProductsMap = new Map<Id,OpportunityLineItem>();
   

    public Displayprodsinopprtunity(ApexPages.StandardController controller) {

    }
        
    public List<OpportunityLineItemwrapper> getProducts() {
        ID str = ApexPages.currentPage().getParameters().get('ID');         
        OppList.clear();
        
        for(OpportunityLineItem a : [Select Id,Quantity,
ListPrice,PricebookEntry.Product2Id,TotalPrice
 PricebookEntry.Name From OpportunityLineItem
 where Opportunity.id=:str]){
            
            
            OpportunityLineItemwrapper opplineItem = new OpportunityLineItemwrapper(a);            
            if (selectedProductsMap.get(a.Id) != null)
                opplineItem.selected = true;

            OppList.add(opplineItem);        
        }
        return OppList;
    }
    
    public PageReference getSelected() {
        selectedProducts.clear();
        for(OpportunityLineItemwrapper accwrapper : OppList)
        if(accwrapper.selected == true) {
            selectedProducts.add(accwrapper.prd);
            selectedProductsMap.put(accwrapper.prd.id, accwrapper.prd);
        }
        return null;    
        
    }
    
    public List<OpportunityLineItem> GetSelectedProducts()  {
        if(selectedProducts.size()>0)
   return selectedProducts;
        else
   return null;
    }    

    public void updateQuantity() {
        List<Id> SelectedIds = new List<Id>();
       
        for(OpportunityLineItem litem: selectedProducts) {            
             OpportunityLineItem updateQuantity = new OpportunityLineItem (Id=litem.Id,Quantity=22); 
             Update updateQuantity ;            
        }      
    }
        }
Nayana KNayana K
Please post VF code to check further
Uvais KomathUvais Komath
What is the usecase?