CANNOT_UPDATE_CONVERTED_LEAD, cannot refer to converted output: [Lead__c]

I get an error when I try to run a user object into an existing master object.

List<Lead> leads =[select Id from Lead where 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 is a custom object that
                                               //has a child relationship to lead.
                                               //ie lead is a parent of social_accounts.
    update existing_lead;
    insert social_account; //if there is an existing lead with same same email,
                           //i'd like to insert new social_account to an exsiting lead.
}

I get this error:


554 System.DmlException: Update failed. First exception on line 0 with id 00Q3000000WW3isEAD; first error: CANNOT_UPDATE_CONVERTED_LEAD, cannot refer to converted output: []

Class.ProcessContact.handleInboundEmail: line 81, column 9 External entry point


even if I comment on "update existing_lead", I get a similar error message.


554 System.DmlException: Insert failed. The first exception on line 0; first error: CANNOT_UPDATE_CONVERTED_LEAD, cannot refer to the converted manual: [Lead__c]

.ProcessContact.handleInboundEmail: 82, 9


.

+3
2

, . . Lead IsConverted, , , . IsConverted , ConvertedContactId Contact.

+13

Lead , Sprint 16 , .

- " " " ", " ", "" " " " ".

- , "" " ", "". , " ".

.

0

Source: https://habr.com/ru/post/1767211/


All Articles