You need to sign in to do that
Don't have an account?

Cannot access an embedded OpportunityLineItem from Controller
Hi there. I have done something similar before but it will not work now.
I cannot figure out for the life of me why not...
Hoping someone can help.
Ok, now, I have a controller. In the controller I have a wrapper class that has an opportunityLineItem.
Now, I can set this value no problem.
So, in my vf page, I cannot access any fields from this embedded opportunityLineItem.
Very bizare:
Here is the nested class in my controller:
public class CustomOppLineItem { public PricebookEntry pBookEntry { get; set; } public OpportunityLineItem oppLineItem { get; set; } public CustomOppLineItem(PricebookEntry pBookEntry, OpportunityLineItem oppLineItem) { this.pBookEntry = pBookEntry; this.oppLineItem = oppLineItem; } }
And here is my visualforce section:
<apex:repeat value="{!customLineItemList}" var="currentOppLineItem" > <!-- Your field values here --> <tr style="font-size:75%;"> <td><apex:outputField value="{!currentOppLineItem.oppLineItem.PricebookEntry.Name}" /><br /> <span style="font-size:60%; font-weight:bold;">
The error states:
Error: Unknown property 'CustomOppLineItem.PricebookEntry'
|
if your wrapper class has the pbookentry, you can access it using:
{!currentOppLineItem.pBookEntry.field_name}
if you want to access the price book entry thru the line item then the syntax should look like yours, except that name is not one of the field that is visible thru the relationship.
the error message is a bit confusing, it implies that you are trying to access a field of your custom class called
PricebookEtnry
but the code shown is not, can't explain that.
All Answers
Doesn't matter.
My mistake
if your wrapper class has the pbookentry, you can access it using:
{!currentOppLineItem.pBookEntry.field_name}
if you want to access the price book entry thru the line item then the syntax should look like yours, except that name is not one of the field that is visible thru the relationship.
the error message is a bit confusing, it implies that you are trying to access a field of your custom class called
PricebookEtnry
but the code shown is not, can't explain that.
Thanks Ron. Spot on. :)