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

Database.insert: IDs created in sObject?

Let's say I create a List of 10 new Account records called accts.  If I do a successful DML insert, then the records in the List will each have the new ID.


If I do successful Database.insert, will the records in the List also have the new ID?  If I do a Database.Insert(accts, false) and one of the accounts is a failed insert, will the other nine in the List still get IDs?




Best Answer chosen by Admin (Salesforce Developers) 

9 of the accounts in your list will have an id, 1 will have a null id.