I am trying to write the results from a database.saveresult to a note. I am trying to figure out how to take the list of values and pass them to the note body field. I am getting a list to string error which I understand but I don't know how to convert the list into a string of values.
Any help? Problem code is right at end of code.
//Session
for (Database.SaveResult sr : srSession) {
if (sr.isSuccess()) {
// Operation was successful, so get the ID of the record that was processed
System.debug('Successfully transfered session. Session ID: ' + sr.getId());
showRecords = FALSE;
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM, 'Successfully transferred Sessions. Session ID: ' + sr.getId()));
}
else {
// Operation failed, so get all errors
for(Database.Error err : sr.getErrors()) {
showRecords = FALSE;
sessionSuccess = FALSE;
System.debug('The following error has occurred.');
System.debug(err.getStatusCode() + ': ' + err.getMessage());
System.debug('Session fields that affected this error: ' + err.getFields());
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL, err.getStatusCode() + ': ' + err.getMessage()));
}
}
}
if(taskSuccess == TRUE){
//create note
note n = new note();
n.ParentId = empSession.Employee__c;
n.Title = 'Task Transfer Record';
n.Body = srSession;
Insert n;
}