0

This seems to have been introduced with Summer '23 as my scratch orgs just did the swap over the weekend. I can't query for SiteDetail with an ORDER BY Id in the query.

Steps to Reproduce:

  1. Create a Site.
  2. Query for that site to get it's Id.
  3. Run this query in your cli to see the expected results sf data query --query "SELECT Id, DurableId, IsRegistrationEnabled, SecureUrl FROM SiteDetail WHERE DurableId IN ('REPLACE_WITH_SITE_ID') ORDER BY Id ASC" --api-version=49.0
  4. Run this query in your cli to see the new error sf data query --query "SELECT Id, DurableId, IsRegistrationEnabled, SecureUrl FROM SiteDetail WHERE DurableId IN ('REPLACE_WITH_SITE_ID') ORDER BY Id ASC"

Error (1): SiteDetail: column Id is not supported in ORDER BY clause

Seems to be the same issue as found here: Order By id not support in Publisher.

2
  • Is this just to bring awareness, or do you have a legitimate use case for being able to order by ID? I'm not sure what the ask is, here.
    – sfdcfox
    Commented Jun 12, 2023 at 23:38
  • @sfdcfox it's partially to bring awareness but also to understand what sObjects can and cannot be ordered by Id so we know what to expect from the platform. For context, I have a SiteDetailsSelector method that uses fflib_SObjectSelector which defaults to adding ORDER BY Id to queries. I can override the getOrderBy() method as a workaround, but it sure is odd that all of a sudden it's required to avoid an error and I'd like to be prepared for this going forward. Commented Jun 12, 2023 at 23:55

1 Answer 1

1

Was able to replicate the issue and error (SiteDetail: column Id is not supported in ORDER BY clause) seem to be expected behavior on 'SiteDetail' with API version greater than 49. Checked more on this with internal team and currently they do not have any intension to make this available for higher versions rather educate users not to use ORDER BY Id in any custom logic going forward and has no effect.

Here is the internal reference #W-8512427 for same.

Currently, we do not have any documentation for sObjects that are not supported.

2
  • What is the rationale for sometimes not supporting ORDER BY Id? This can be a really important ordering when needing to be able to paginate data in a simple manner to work around query limits.
    – Phil W
    Commented Jun 13, 2023 at 8:17
  • 1
    Re-checked with concern team on above, There was some internal fixture for this and ORDER BY Id is not supported for objects which don't have an Id column. That was allowed in the past, but it had no effect.
    – Vinay
    Commented Jun 14, 2023 at 12:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .