New answers tagged


There is no way to do this without an iteration, as the only viable alternative, using a Map, won't work with one or more null values present in the list. You don't need to check success first: Set<Id> insertedLeads = new Set<Id>(); for (Database.SaveResult result: results) { insertedLeads.add(result.getId()); } ...

Top 50 recent answers are included