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
Sachin Patil 57Sachin Patil 57 

How to get only the record values from a databse.saveresult list if the insertion fails.

Hi,
I am in part whereI need to get the failed records in a CSV. I am able to get the failed records into a CSV but the records are coming with the fieldNames as I have added the screenshot below.  But I dont want the fields coming with the field Names and object Name.User-added imagePlease Someone help me in getting only the record values

Thanks in Advance
Sachin
OFröhlichOFröhlich
Hi,
I guess you work with a list. Try to remove the first entry of the list - xyz.remove(0)
Olli
Sachin Patil 57Sachin Patil 57
Hi,
The CSV I got is with the String. The String I have used is
String errorRecords+= insertRecords[j]+','+err.getMessage()+'\n';   And
List<Sobject> insertRecords

I have added all the error records to a string and then I have converted the string to a csv.
For inserting In have used the List<sobject> whixh I will be using in the database error loop to get each failed record.