当我尝试将自定义对象插入现有引导对象时收到错误消息。
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.
}
我收到此错误:
554 System.DmlException:更新失败。第 0 行的第一个异常,id 为 00Q3000000WW3isEAD;第一个错误:CANNOT_UPDATE_CONVERTED_LEAD,无法引用转换后的线索:[]
Class.ProcessContact.handleInboundEmail:第 81 行,第 9 列
外部入口点
即使我注释掉“update existing_lead”,我也会收到类似的错误消息。
554 System.DmlException:插入失败。第 0 行的第一个异常;第一个错误:CANNOT_UPDATE_CONVERTED_LEAD,无法引用转换的潜在客户:[Lead__c]
Class.ProcessContact.handleInboundEmail:第 82 行,第 9 列
外部入口点
我将不胜感激任何建议。
问候
最佳答案
此错误意味着潜在客户记录已转换为联系人。转换后,潜在客户记录无法更新。 Lead 对象有一个 已转换 您可以检查它是否已转换的属性。如果 IsConverted 为真,转换后的联系人 ID 将保存新联系人记录的联系人 ID。
Lead Object reference
关于foreign-keys - CANNOT_UPDATE_CONVERTED_LEAD,无法引用转换的潜在客户 : [Lead__c],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3824196/