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
gfassettgfassett 

Simple Quote & Opportunity Products Sorting

I have installed and customized Simple Quote, so I can print a PDF from an opportunity as a quote to include my Opportunity Products.  In the Develop->Pages->Quote->edit, I have done some simple HTML to adjust the look and feel of my PDF/Quote.

 

However, I am puzzled that this:

 

<apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">

 

as it is repeating, the default "sort" on the records for OpportunityLineItems seems to be random, not even FIFO.  However, in the Opportunity, inside salesforce itself, there is the ability to SORT on Opportunity Products, and I can put them anyway I want in the opportunity.  I can not however, seem to find how to get this APEX:REPEAT to output them in the same order.

 

Has anyone a solution or a thread that is solved on this, I am new to this forum, so I apologize if I am asking a question that has been asked before.

 

Regards,

George Fassett 

imcclellanimcclellan

I had the same problem and did not find a built in solution like I expected (i.e. a switch to sort by X)

 

What I had to do was add a sort value field to every product and then had a developer write some code to sort by that field.  Most of the changes were to salesQuotes.cls, in constructing the quote line items table to be printed.  I found some relevant answers on the web if you keep searching.

  

Good luck!