You need to sign in to do that
Don't have an account?
«Specified Contact must be parented by specified Account» while converting lead
Hi all,
I have an issue with convertLead() call. SF keeps returning the same error message once and again : «Specified Contact must be parented by specified Account» whilst I am pretty sure the contact specified is asociated with specified account.
The account I specify is business so the rule in APEX API documentation «If you are converting a lead into a person account, do not specify the contactId or an error will result. Specify only the accountId of the person account» does not apply.
This is my code:
Contact oldestContact = getOldestContact(oldestContactsSOSL));
Lead oldestLead = getOldestLead(leadsEnSF));
LeadConvert lc = new LeadConvert();
lc.leadId = oldestLead.Id;
lc.contactId = oldestContact.Id;
lc.accountId = oldestContact.AccountId;
lc.ownerId = oldestContact.Account.OwnerId;
lc.convertedStatus = "Converted";
lc.doNotCreateOpportunity = true;
lc.overwriteLeadSource = true;
lc.sendNotificationEmail = true;
LeadConvertResult[] lcr = SalesforceController.instancia.convertLeads(new LeadConvert[] { lc });
if (lcr[0].success)
{
...
}
else
{
...
}
Any comment would be really appreciated. Thanks in advance.
Hi all again.
I know the cause of the error. If the Lead I specify in lc.leadId does not have the field Company populated in SF (I mean, setting this field programatically just before the convertLeads call does not work) and the Account I will merge into is business, I get the error mentioned.
Anyway, I think the message given by SF is not accurate. The message would be much useful if it said something about the field Company.
Hope this helps.
All Answers
Hi all again.
I know the cause of the error. If the Lead I specify in lc.leadId does not have the field Company populated in SF (I mean, setting this field programatically just before the convertLeads call does not work) and the Account I will merge into is business, I get the error mentioned.
Anyway, I think the message given by SF is not accurate. The message would be much useful if it said something about the field Company.
Hope this helps.
Am getting a similar error saying the same
ConvertLead failed. First exception on row 1; first error: INVALID_ID_FIELD, Specified Contact must be parented by specified Account: []
I checked if the names of the leads before converting using a script and it dosen't have any duplicate values and the contacts were parented with specific accounts.