Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Add custom setting for default query sorting on SObj Type name field #73

Open
jongpie opened this issue Aug 23, 2017 · 0 comments
Open

Comments

@jongpie
Copy link
Owner

jongpie commented Aug 23, 2017

SOQL doesn't seem to have any obvious default order for the resulting list of SObjects. It'd be nice if there were an option to have QueryBuilder.cls sort by the SObject Type's name field (Schema.Account.Name, Schema.Task.Subject, Schema.Case.CaseNumber, etc) if no other ordering is specified.

The first option for implementing this is to have it controlled by a custom setting. By default, Nebula would not sort the results, but if the custom setting is updated (probably by flipping a boolean field?), then Nebula would sort all queries by name field.

A second option is to add something like a sortQueryResults() method to the query builder implementations. Then the method can be optionally called when someone wants the results to be sorted by name field

new SObjectQueryBuilder()
  .setSObjectType(Schema.Account.SObjectType)
  .sortQueryResults() // New method to sort the List<SObject> results by the sobj type's name field
had.

A third option is to implement both options one AND two so that there is configurable control of the default behaviour and programmatic control for individual instances of a query builder.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant