We are trying to insert some records into database by using Database.SaveResult. It is dynamically typed Sobjects as in the following code:
List<SObject> castInsertRecords = (List<SObject>)Type.forName(listType).newInstance(); castInsertRecords.addAll(dataToInsertList); Database.SaveResult insertResultList = Database.insert(castInsertRecords, false);
However, I won't be able to get the Id of the records which failed. So it would be really hard to find out which records are actually failing. Is there a possible way to find out the external Ids of the related records when it failed inserting?