While adding products to an opportunity in Salesforce, you can not specify the values for the 'SortOrder' field on Opportunity Line Items. That is very weird, and is a feature requested more than 7 years ago right now (as I've seen in an Idea Exchange thread).
I have a request that I need to be able to build a page that parses a CSV file, and creates the listed products and create a relationship with a specified opportunity. Parsing is fine, and so is creating all of the objects. However, I can't seem to find a way to sort the products the way I want to.
If the list is like this:
- Product C
- Product A
- Product B
Then I would like them to appear just like that in the opportunity's related list. But Salesforce orders them by the name, so the lists end up like:
- Product A
- Product B
- Product C
The order is relevant in my situation, so I would like to know if it is possible to insert the Opportunity Line Items records in a specific order, so that they end up in the right order. I'm asking this because I've tested my work so far, and I got the products inserted, but not in the right order.