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
forceDotMomforceDotMom 

VF Error Message on Quote SObject - Please Help!

I am working on a fairly basic Quote template using the new standard Quote object, and all is well until I get tot he <apex:repeat> section where I want to list all the Quote Line Items associated with the Quote.

 

I have this:

 

 

<apex:repeat var="line" value="{!Quote.QuoteLineItem}">

 

 And I am getting this error message:  

 

 

Error: Invalid field QuoteLineItem for SObject Quote

 

I am using the standard Quote controller.  I also get a similar error when I try to use  __r after QuoteLineItem.

 

Can someone please tell me what I am doing wrong here?

 

Thanks

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Jeremy.NottinghJeremy.Nottingh

You need to use the name of the relationship, not the object. In this case, use "QuoteLineItems" rather than "QuoteLineItem". QuoteLineItems equates to a list. QuoteLineItem is just the name of an object.

 

<apex:repeat var="line" value="{!Quote.QuoteLineItems}">

Jeremy

All Answers

sg88324sg88324

Hey,

 

I think you cant use Quote.QuotelineItem to get the child lineitems cos it takes it as object.field. Hence the error.

Try to use <apex:relatedlist> tag instead.

 

Thanks,

Sandeep

Jeremy.NottinghJeremy.Nottingh

You need to use the name of the relationship, not the object. In this case, use "QuoteLineItems" rather than "QuoteLineItem". QuoteLineItems equates to a list. QuoteLineItem is just the name of an object.

 

<apex:repeat var="line" value="{!Quote.QuoteLineItems}">

Jeremy

This was selected as the best answer
forceDotMomforceDotMom

Thank you both!  Both things worked.  I ended up going with Jeremy's suggestion, because the final product here is a printed document, so <apex:relatedList> didn't allow me to format the output in the way I needed too.

 

Thanks for the help! :smileyhappy: