Each orderable field on a record, such as on an account, gets a corresponding field on Account_OrderBy with type OrderByClause. The OrderByClause type allows you to specify ascending or descending order, as well as the order of null values.
Orderable fields are linked to InputObject types like OrderByClause, depending on their type, such as User_OrderBy for user fields, or OrderByGeolocation for geolocation fields.
The ResultOrder enumeration type specifies whether the results are ordered in ascending or descending order.
By default, the result is ordered in ascending order.
ResultOrder enumeration type
1# Specifies whether the results are ordered in ascending or descending order2enum ResultOrder{3 ASC4 DESC5}
NullOrder Enum
The NullOrder enumeration type specifies the order in which nulls appear in the result set. By default, null values are sorted first.
NullOrder enumeration type
1# Specifies the order in which nulls appear in the result set2enum NullOrder{3 FIRST4 LAST5}
The order by object has input object fields for each parent relationship the object has. The field has the same name as the parent relationship, and have the OrderBy type corresponding to the object that the relationship points at.
1type Contact{2 AccountId: IDValue3 Account: Account # the 'Contact' sObject has a relationship 'Account' which points at the 'Account' object4}56input Contact_OrderBy{7 AccountId: OrderByClause8 Account: Account_OrderBy # 'Account_OrderBy" is used as the input type for the 'Account' input object field9}1011input Account_OrderBy{12 # has the order by fields for Account13}
OrderByGeolocationClause Type
Geolocation fields map to the OrderByGeolocationClause type. Its constituent fields Location__Latitude__s and Location__Longitude__s map to the OrderByClause type.