Lightning Opportunity Product Sort Button is Missing? - Answers - Salesforce Trailblazer Community
Ask Search:
Cameron NevayCameron Nevay 

Lightning Opportunity Product Sort Button is Missing?

Just migrated to Lightning and noticed that the Opportunity Product Sort Button is no longer present (see photos below). It's always been frustrating how SF randomly sets the sort order when you add products and doesn't just make the set order as you enter the products. It used to be bareable that there was a sort option but now I can't find that anywhere on Lightning. We need this desperately because we'll sometimes have upwards of 20 products and the quote gets generated in the most random order. Any ideas? 

Classic Sort Button

Lightning Sort Button Not There

Ahilesh RagavanAhilesh Ragavan
Did you try clicking on the column names in related list? Like below.
That should help you sort based on the fields you need.

User-added image
Katreena WiszniewskiKatreena Wiszniewski
I did try this as suggested...Sorting like that does not seem permanent and even though it has 1,2,3 listed on LHS there I cant determine way to control the order of it.
Next time you go into Products is reverts back to the default - Sorted by Sort Order, Total Price, Opportunity Product Name
Users want it to sort by the order they enter each product not product name aphabetically, as it seems to list them.
Is there any way to change this default ordering as in screen shot below in lightning?

User-added image
Cameron NevayCameron Nevay
Hi Katreena, I've been unable to find a solution yet. 
Matthew ChitwoodMatthew Chitwood
I am adding our support for this inconsistency between Lightning and Classic.  There is not a way in Lightning to edit the order of Products in "Opportunity Products" or "Quote Line Items" (this used to be called "Sort" in Classic - standard button - however you weren't really sorting on a field name or column, you were "re-ordering").  Any insight into a workaround or update on getting this parity in Lightning is appreciated.
Brandon RotheBrandon Rothe
I set up a custom field on the Opportuntiy Line Items called "Sort Order" and then defaulted it to the number 9 so that when an Opportunity has products added to it, you can edit the "Sort Order" field and to put the line items in the order you want them to be in.  It's not perfect but it works for now.  The reason for the default number is that the "Sort Order" field will be first if it's blank so you need a value in there by default.
Salesforce Lightning Sort Order Opportunity Line Item work around
Comms ChoiceComms Choice
Even if you do some sorting in lightning, when you go to a quote or some sort of template, the opportunity line items or opportunity products appear in alphebetical order. When I generate the same quote in classic it appears in the order I submitted it
chetan bhatlachetan bhatla
Has anyone found the solution or work around for this problem. Opportinity line items detail page showing sorting on all the columns except product columns. please advise.
Mark ThomasMark Thomas
From what I've seen, there's not a bullet proof work around although I do like Brandon's idea. I would say that it feels like Salesforce wants us to move toward one of the CPQ tools, but they have a Trailhead module for Quotes. Unfortunately it only includes one product that you add to the quote. I still end up creating the quote in Lightning, then as the final step, switch to Classic, sort and create the PDF.  
Jenifer RiveraJenifer Rivera
Has anyone found another solution or work around for this yet? How can "Quote Line Items" be sorted and remained in that order when creating a Quote PDF using Lightening? The sort tool is visible in Classic, but not Lightening.
Brandon RotheBrandon Rothe
I have an update to my original post as the sorting still wasn't effective and required too much of the end user.

You can see in the original post above I defaulted everything to 9 but that didn't scale.  But I realized that I could set the default to blank and then use that field to sort based on our products.

We have a specific order that we like our products to display (User Licenses, modules, then services...etc) and since we want the order to be standardized, I added a "Sort Order" field on the Product Object which I then add using a workflow to the Opp Line Item when it's created to force a default Sort Order.

Screenshot of our product screen (Some are the same as the rep will only pick one of the 4 products):
Products with Sort Field populated

I then created a workflow rule that looked for blank sort order fields and if blank, would update the Opp Line Item Sort Order Field with the Product Sort Order number.  The reason I only have the workflow look for Blank is it allows you to override the initial sort order if needed.

You then end up with Opp line items that look like this:
Opp Line Items with Sort

It's worked out pretty well and users rarely switch the sort order once it's in place. 
Jenifer RiveraJenifer Rivera
Very Nice!
Laura SquiresLaura Squires
@Brandon Rothe Can you share what the workflow rule looks like please.
Brandon RotheBrandon Rothe

Here you go Laura!

Workflow Rule (any time the Sort Order field is blank, run the rule)
Workflow Rule for Sort Order (anytime a "Sort Order" is blank)

Update the sort order on the Opp Line Items based on the associated Product define "Sort Order"
Populate the Sort Order from the related Product from the Opp Line Item

I only have this running if the field is blank, that way reps can put their own sort order and it won't get overridden.
Let me know if you need more screenshot or other info.

Laura SquiresLaura Squires
Thanks. Does this keep the sort order when you generate a quote?
Brandon RotheBrandon Rothe
Good question, I do not know as we don't use quotes.  I'm guessing you might have to do this on the Quote level too and then sync the Quote sort to the Opp Line Item (basically the quote overwrites the Opp so in theory you could have different sort orders for different quotes which would then write the sort order to the Opp when it updates the primary.  But guessing.