+ Start a Discussion
Shrawan RainaShrawan Raina 

How to show Line Items ordered on the basis of Line Item Number?

Hi

I am following the Force.com Workbook and I created a method to renumber the line items under the invoice Invoice and Line Item have a master detail view. The method is being called from a button on the Invoice and it works correctly (updated the Line Number beginning from 1).
The issue is that the line numbers do no always appear ordered in the App. Sometimes the Line Items come as 1,3,2,4.

How can i show these line items in order in the App?
magdielhfmagdielhf
Are you using  a VisualForce page embedded in the layout to display the related list of items ?
In this case you could make use of Order By inside your SOQL query or a more advanced approach creating your own wrapper implementing Comparable interface (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_comparable.htm)

Here is a good example of a custom related list using VisualForce and Apex, not using the techniques I mentioned before but it'll get you on track,
http://salesforcesource.blogspot.com/2008/10/how-to-create-custom-related-list-on.html?_sm_au_=i7HPLPWHD4nDbZH5

Or just using the standard related list provided by salesforce ?
In this case it's only known to me that you're able to edit the search layout so any related list would contain this customized set of columns