You need to sign in to do that
Don't have an account?
Sfdc Wolf
Sorting the record list by field in Opportunity Products and Quote Line Items related lists
We all know that there is a sort by field option in Page layout for all most all the related lists except Opportunity Products and Quote Line Items. I need to sort the line items by line number for both Opportunity products and Quote Line Items.That's my first question.
FYI, I tried [ order by 'custom field' asc ] via SOQL Query already, but the sorting is only done depending upon product name.
Like we have list.sort() method, do we have any list.sortby(field)method ?
I also have service type line items created programatically for each product which I have customized already, but I need to sort and display each product followed by its service type line item. any suggestions are much appreciated !! TIA
FYI, I tried [ order by 'custom field' asc ] via SOQL Query already, but the sorting is only done depending upon product name.
Like we have list.sort() method, do we have any list.sortby(field)method ?
I also have service type line items created programatically for each product which I have customized already, but I need to sort and display each product followed by its service type line item. any suggestions are much appreciated !! TIA
Sort wrapper classes
Add “implements Comparable” to the class definition. (ie global class className implements comparable {} )
Add a method that looks like this…
Public integer compareTo(Object compareTo) {
wrapperClassName compareToXXX = (wrapperClassName)compareTo;
Integer returnValue = -1;
If (sortFieldNameFromWrapperClass == compareToXXX.sortFieldNameFromWrapperClass) returnValue = 0;
If (sortFieldNameFromWrapperClass > compareToXXX.sortFieldNameFromWrapperClass) returnValue = 1;
Return returnValue;
}
here is some actual code (apvreated)...