I am trying to write the leadConversionResult error message to a custom field. As you can see I already write the error to the debug log. When I attempt to assign to a text field I get the following error message:

Illegal assignment from List to String

Here is my code:

    system.debug('The Following Error Occurred on::' + leadConvertResult.getLeadId() + 'Error is::' + leadConvertResult.getErrors());

    Lead L = new Lead(id = leadConvertResult.getLeadId());
    L.AutoConvert__c = FALSE; 
    L.Possible_Duplicate__c =TRUE;
    L.Conversion_error_message__c =leadConvertResult.getErrors();

    if(L.Ignore_Duplicate_error__c == FALSE){

1 Answer 1


As the error says, you're trying to convert a list of objects into a plain string. You need to convert the errors into a plain string:

String[] messages = new String[0];
for(Database.Error error: leadConvertResult.getErrors()) {
L.Conversion_Error_Message__c = String.join(messages, '\n');
  • Thanks alot, It didn't occur to me to use an array! Commented Dec 29, 2016 at 17:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .