• YRoze
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 1
    Replies

I had a couple of questions around the ordering of object content when they are inserted into Salesforce. Specifically, my ask would be a thorough explanation of how content is ordered and retrieved. 

After searching around for awhile it sounds like Salesforce gives no guarantees on ordering of results (specifically noted in the documentation online) as well as other sources online. I'm hoping to pose my questions in respect to their online counterparts below.

a) Here (https://developer.salesforce.com/forums/?id=906F000000092srIAA) for example indicates that ordering by CreatedDate after the insertion of two accounts one after the other will give inaccurate results but that is to be expected. More specifically sfdcfox's later on indicates that you can order by Id instead and that they are always in ascending order.
b) Here (http://salesforce.stackexchange.com/questions/7667/soql-result-ordering-in-the-absence-of-an-order-by-clause)indicates that if the Order By clause is missing then a variety of factors that may affect it which further is corroborated with my third source
c) The Salesforce Developer's guide also indicates (https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select.htm)that there is no guarantee for order unless you use the Order By clause.

So my questions then follow:
1) If there is no gurantee for order then how can we guarantee that Id is ALWAYS created in ascending order. Who or what is more accurate in this case? And is this a reliable way to order?
2) The Salesforce Developer's guide (a) is ambiguous just stating that there is no guarantee and likewise the second point (b) indicates that there are a variety of factors that influence this. Does anyone know specifically what the cases and conditions would be?
3) What is the most basic case as well as the 80% satisfiable cases for a default behaviour? If I run multiple inserts on a default object will it be inserted in that order or garble it. And when I retrieve that data via SELECT Id, Name FROM [OBJECT] will it give it back in the order that it had previously inserted with (garbled or in order).

  • September 15, 2015
  • Like
  • 1

I had a couple of questions around the ordering of object content when they are inserted into Salesforce. Specifically, my ask would be a thorough explanation of how content is ordered and retrieved. 

After searching around for awhile it sounds like Salesforce gives no guarantees on ordering of results (specifically noted in the documentation online) as well as other sources online. I'm hoping to pose my questions in respect to their online counterparts below.

a) Here (https://developer.salesforce.com/forums/?id=906F000000092srIAA) for example indicates that ordering by CreatedDate after the insertion of two accounts one after the other will give inaccurate results but that is to be expected. More specifically sfdcfox's later on indicates that you can order by Id instead and that they are always in ascending order.
b) Here (http://salesforce.stackexchange.com/questions/7667/soql-result-ordering-in-the-absence-of-an-order-by-clause)indicates that if the Order By clause is missing then a variety of factors that may affect it which further is corroborated with my third source
c) The Salesforce Developer's guide also indicates (https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select.htm)that there is no guarantee for order unless you use the Order By clause.

So my questions then follow:
1) If there is no gurantee for order then how can we guarantee that Id is ALWAYS created in ascending order. Who or what is more accurate in this case? And is this a reliable way to order?
2) The Salesforce Developer's guide (a) is ambiguous just stating that there is no guarantee and likewise the second point (b) indicates that there are a variety of factors that influence this. Does anyone know specifically what the cases and conditions would be?
3) What is the most basic case as well as the 80% satisfiable cases for a default behaviour? If I run multiple inserts on a default object will it be inserted in that order or garble it. And when I retrieve that data via SELECT Id, Name FROM [OBJECT] will it give it back in the order that it had previously inserted with (garbled or in order).

  • September 15, 2015
  • Like
  • 1