function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
billgreenhawbillgreenhaw 

SortOrder field on OpportunityLineItem... can I write or update this field?

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_opportunitylineitem.htm

 

Can I write to when inserting or edit this field?  I need to actually change the sorting this way (not a workaround using  another field and displaying...data is part of integration).

 

I have two issues.

 

One is the Sorting only shows one field. I would like to create a VisualForce page that has additional fields in the grid, change the order, and write back.

 

Other is create some large opportunities using APEX and would like to write the SortOrder when these are created. I believe it does not write by my sort, and resorts when inserted (is this correct?)

 

 

Andy BoettcherAndy Boettcher

Salesforce's default related list sort order is rather not useful and always not what you're looking for...so take that as it is.

 

For your issues - you can absolutely create a VF page to display the OLIs and either just show it by itself or include it as a VF section in the Opp Page Layout - whatever your preference is.

 

For the sort order - if you're doing this completely within VF, I would advise to put a custom field of "Sort Order" or the like on the OLI object.  On your record "before insert" trigger, find the lowest number first then increment and store the value in this field.  Rinse and repeat for the subsequent records in the trigger.

 

-Andy