I added a value to a multi-select picklist field. Then I reordered the value to fit it in the list. After this I opened a record of this object and added this new value.

When looking at it in the Salesforce GUI it looks as I expect, i.e. it is located in the correct order. But when querying the field of this record the new value is located on the last position.

EXAMPLE: This is the way it looks (number 64) in the Salesforce GUI 10; 20; 30; 40; 50; 64; 100; 200; 300; 400; 500; 600; 700; 800; 900; 1000

When querying the record the field value displays like this 10;20;30;40;50;100;200;300;400;500;600;700;800;900;1000;64

This is important since I use the values of this record as a key document for use in a portal. Any clue why this happens?

I have tried to clone the record, but no difference.

Regards / Niklas


As far as the database is concerned, the values were simply entered in the order they were created. What you've done is tell SF to change the order in which they're displayed in the GUI. That's why they query results will return the order in which they were created instead of the order in which you've told the GUI to display them. The query is simply querying the memory locations and not the GUI.

| improve this answer | |
  • I understand that. Still I think that since there is a reorder mechanism for the field, this should be consistent disregarding whether you are displaying it in the SF GUI or querying with the API. I solved this however by sorting the values in the controller before displaying them in the VF-page. – nickwick76 May 24 '13 at 13:19
  • Had you done a "replace", you might have gotten different results and not needed to sort your results. picklists are known to be "funky" when it comes to display order at times. Glad you found a solution and got it "sorted" so to speak. ;) – crmprogdev May 24 '13 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.