foreign-keys - CANNOT_UPDATE_CONVERTED_LEAD,无法引用转换的潜在客户 : [Lead__c]

标签 foreign-keys salesforce foreign-key-relationship apex-code

当我尝试将自定义对象插入现有引导对象时收到错误消息。

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/

相关文章:

mysql - 更改字符集后无法添加外键约束

salesforce API jar 的 Maven 阴影 jar 中的 java.lang.NoClassDefFoundError

javascript - 在 Salesforce 中的记录类型之间转换

salesforce - 如何在案例下创建 CaseFeed?

azure - 维护 Azure SQL 和表存储中存储的数据之间的关系

php - YII CGridView。试图显示其他表的属性。关系不工作

MySQL - 删除时的外键在非空字段中设置为空

c# - LINQ to Entities 外键关联

sql - 外键可以有一个常量而不是一个字段名吗?将 FK 与 STI 子类相关联

postgresql - 删除唯一约束postgresql的问题