I Have a Picklist Field Like (Orderstatus__c) Field, Values are (A, B, C, D, E, F) This Picklist Field, when i am querying the Orderstatus__c Filed Those values will be displaying like Un order (B, E, C, D, A, F).
1 Answer
SOQL, Apex and API access on these fields will however return the values in their created order via Setup or deployment. Similar to when using ORDER BY in SOQL with regards to Picklist fields - "sorting is defined by the picklist sort determined during setup".
-
Please do not post link only answers as the links often break. See How to Answer Commented Oct 11, 2018 at 10:00
-
That is not correct... i have 100 Records, first 20 records Orderstatus__c Field Value is 'A' , second 21 to Remaining 50 records, Orderstatus__c Field value is C, and another remaining record values display....– aliCommented Oct 11, 2018 at 14:06
-
As a test I added a new multi select pick list with the following values in this order. The initial 3 picklist values were added at creation and the following 4 at a later time: Values API Name A A M M X X B B Q Q Z Z Y Y I then selected values on two different objects in a random order Record1.Test__c = M;X Record2.Test__c = A;M;X;B;Q;Z;Y So here it looks like the creation order. I've I re-order the picklist values to be alphabetical I still get the same result, even after edit the records: Record1.Test__c = M;X Record2.Test__c = A;M;X;B;Q;Z;Y– Dan BeerCommented Oct 12, 2018 at 12:49