Adding a Default Sort to the Add Opportunity Products List in SalesLogix Web

Usually by the third time I see a question asked, I realize it needs to be a blog post. I’ve been asked by a couple of customers how to add a default sort to the products list on the Add Opportunity Products form in the SalesLogix Web client. The question of how to add a default sort to the list of products in the Add Opportunity Products form in the web client surfaced again today so I am posting the answer here.

The approach to sorting the products list on the Add Opportunity products form is different than what I have outlined before for simply sorting a grid. The opportunity products list is not a DataGrid, but a Tree control.

To sort the products list, instead of telling the control to sort, we will just sort the list of objects that it is bound to.

First, locate the AddOpportunityProduct SmartMart. This is a custom SmartPart, not a QuickForm, so you won’t find this under the Opportunity entity itself, but instead in the Sage SalesLogix Portal in following location (we’ll just need the code-behind, or “cs” file for this, not the “ascx” file):

Support FilesSmartPartsOpportunityAddOpportunityProduct.ascx.cs

Double-click that file to open it in the Application Architect. In the code, look for the method named GetProductList. You’ll see the following two lines at the very end of that method:

List<Product> ProductList = criteriaProduct.List<Product>() as List<Product>;
return ProductList;

Right before those two lines, add the following line (in this case, we’ll sort the list by family):

criteriaProduct.AddOrder(expProduct.Asc("Family"));

Obviously, you can replace “Family” with any other valid property name on the Opportunity entity to sort the results by.

Want content like this delivered to your inbox? Sign up for our newsletter!
ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

1 Comment

  1. Ryan, this seems to have changed with v8. Can you suggest a method for doing this in v8?

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *