You need to sign in to do that
Don't have an account?
opportunityLineItem.PricebookEntry.Name = null
Controller
System.debug('opportunityLineItems ------------------'+opportunityLineItems);
for(OpportunityLineItem opportunityLineItem:opportunityLineItems){
System.debug('opportunityLineItem------------------'+opportunityLineItem);
System.debug('PricebookEntryId------------------'+opportunityLineItem.PricebookEntryId);
System.debug('PricebookEntry Name------------------'+opportunityLineItem.PricebookEntry.Name);
}
VF
<apex:pageBlockTable value="{!OpportunityLineItems}" var="item" headerClass="headerRow" rowClasses="odd even">
<apex:column value="{!item.PricebookEntry.Name}" headerClass="headerRow" headerValue="Deal Products" />
<apex:column value="{!item.PricebookEntry.ProductCode}" headerClass="headerRow" headerValue="Part Number" />
<apex:column headerClass="headerRow" headerValue="QTY" value="{!item.Quantity}"/>
<apex:column headerClass="headerRow" headerValue="MSRP" value="{!item.ListPrice}" />
</apex:pageBlockTable>
Hi,
My first question, have you mention the field name in that query define inthe controller?
if yes, please post the controller class.
Thanks For replaying my complete problem
I have opportunityID and priceBookID ,I need to display the ProductName,ProductCode,Quantiy and Price in VisualForcePage.
In controller
I got the List of pricebookEntry for the given priceBookID
I added the List of pricebookEntry to List opportunityLineItem for given opportunity.
But when I try to get the opportunityLineItem.PricebookEntry.Name in Controller I am getting Null Value
In VisualforcePage {!item.PricebookEntry.Name} I am getting null value.
Controller
List<PricebookEntry > pricebookEntrys = [Select id,ProductCode,UnitPrice,UseStandardPrice,Name from PricebookEntry where pricebook2ID =: priceBookID];
List<opportunityLineItem> opportunityLineItems = new List<opportunityLineItem>();
System.debug('------------------------pricebookEntrys Size='+pricebookEntrys);
for(PricebookEntry pricebookEntry:pricebookEntrys){
OpportunityLineItem opportunityLineItem = new OpportunityLineItem();
opportunityLineItem.OpportunityId = opportunityID;
opportunityLineItem.PricebookEntryId = pricebookEntry.Id;
opportunityLineItems.add(opportunityLineItem);
}
System.debug('opportunityLineItems ------------------'+opportunityLineItems);
for(OpportunityLineItem opportunityLineItem:opportunityLineItems){
System.debug('opportunityLineItem------------------'+opportunityLineItem);
System.debug('PricebookEntryId------------------'+opportunityLineItem.PricebookEntryId);
System.debug('PricebookEntry Name------------------'+opportunityLineItem.PricebookEntry.Name);
}
Visual Force
<apex:pageBlockTable value="{!OpportunityLineItems}" var="item" headerClass="headerRow" rowClasses="odd even">
<apex:column value="{!item.PricebookEntry.Name}" headerClass="headerRow" headerValue="Deal Products" />
<apex:column value="{!item.PricebookEntry.ProductCode}" headerClass="headerRow" headerValue="Part Number" />
<apex:column headerClass="headerRow" headerValue="QTY" value="{!item.Quantity}"/>
<apex:column headerClass="headerRow" headerValue="MSRP" value="{!item.ListPrice}" />
</apex:pageBlockTable>
Hello Kalluru,
here is a untested version of your request:
1. write a wrapper class:
2. write this in your extensionclass:
3. put this table in your VF Page:
I hope, this helps..
best regards
Alexander