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
DaveKempDaveKemp 

Strange ordering on contractlineitem query

Hi,

 

I've got some code in a trigger for updating a service contract (checkboxes) based on the types of contractlineitems it has associated with it and whether they are Active, Inactive or Expired.

 

When I sort the SOQL query by the contractlineitem status field I get the following results (sorted by Status)

 

Service Contract 1 

Inactive

Inactive

Active

 

Service Contract 2

Active

Active

Expired

 

I'm not understanding how, using the same query and ordering, Active can come before Expired, but after Inactive?

 

Any help appreciated as this is driving me nuts!

 

Dave

 

 

Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan

Hi,

 

Can you provide your query, so that it will be easier to understand why you got those results?

 

Hope so this helps you...!

 

Please mark this answer a Solution and please give kudos by clicking on the star icon, if you found this answer as helpful.

 

 

digamber.prasaddigamber.prasad

Sort values alphabetically, not in the order entered. Values will be displayed alphabetically everywhere.


Hi,

There is a very interesting option available while creating a picklist field "Sort values alphabetically, not in the order entered. Values will be displayed alphabetically everywhere." If you check this to true, then only sorting will happen accordingly to alphabet, otherwise sorting will happen according to order of picklist values you have enter in the field.

Looking into problem, I assume you have not selected above said option as true. And the order of picklist values entered in 'Status' field is:-

 

Inactive
Active
Expired

 

Because of which you see strange ordering in 2 different results of same query on same object.

Please validate.

Happy to help you!

Regards,
Digamber Prasad