foreign keys - CANNOT_UPDATE_CONVERTED_LEAD, cannot reference converted lead: [Lead__c] -
i getting error message when try instert custom object exisiting lead object.
list<lead> leads =[select id lead email =:lead.email ]; if(leads.size()>0) { lead existing_lead = new lead(id = leads[0].id); social_account.lead__c = existing_lead.id; //social_account custom object //has child relationship lead. //ie lead parent of social_accounts. update existing_lead; insert social_account; //if there existing lead same same email, //i'd insert new social_account exsiting lead. }
i getting error:
554 system.dmlexception: update failed. first exception on row 0 id 00q3000000ww3isead; first error: cannot_update_converted_lead, cannot reference converted lead: []
class.processcontact.handleinboundemail: line 81, column 9 external entry point
even if comment out 'update existing_lead', similar error message.
554 system.dmlexception: insert failed. first exception on row 0; first error: cannot_update_converted_lead, cannot reference converted lead: [lead__c]
class.processcontact.handleinboundemail: line 82, column 9 external entry point
i appreciate suggestions.
regards
this error means lead record has been converted contact. once converted, lead record cannot updated. lead object has isconverted property can check see if has been converted. if isconverted true, convertedcontactid hold contact id of new contact record.
Comments
Post a Comment