+ Start a Discussion
dmchengdmcheng 

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?

 

Thanks

David

Best Answer chosen by Admin (Salesforce Developers) 
WizradWizrad

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