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
PuzzledPuzzled 

Are objects added in list order and their returned IDs also in that order?

I am trying to create a group of accounts and one contact per account, bulk-enabled.  The most straightforward way is to add all the accounts and then all the contacts.
 
If I put the new accounts and contacts into lists in the same order, will the IDs I get back from inserting the accounts be in the same order as they were in the list so I can use their IDs in the contact inserts?
 
Thanks.
ShamSham
executing a DML statement doesn't alter the order of Lists,
The IDs will be properly populated after execution of DML statement and the order maintained,
so you can safely go ahead and code your implementation.