You need to sign in to do that
Don't have an account?

convertLead to an existing PersonAccount: error - cannot associate a contact with a consumer account
Hello,
I'm trying to convert a Lead to an _existing_ Person Account using convertLead.
Any ideas on what
cannot associate a contact with a consumer account
means? According to docs, I should set contactId to null which I'm doing.
public LeadConvertResult[] convertLead (ID leadId, ID contactId, ID accountId, boolean overWriteLeadSource, boolean doNotCreateOpportunity, String opportunityName, String convertedStatus, boolean sendEmailToOwner, ID ownerId) {
LeadConvert leadConvert = new LeadConvert();
// set to null when converting to an existing person account
leadConvert.setContactId(null);
leadConvert.setOwnerId(ownerId)
leadConvert.setAccountId(accountId);
leadConvert.setLeadId(leadId);
leadConvert.setOverwriteLeadSource(overWriteLeadSource);
leadConvert.setDoNotCreateOpportunity(doNotCreateOpportunity);
leadConvert.setOpportunityName(opportunityName);
leadConvert.setConvertedStatus(convertedStatus);
leadConvert.setSendNotificationEmail(sendEmailToOwner);
ConvertLead convertLead = new ConvertLead()
convertLead.setLeadConverts([leadConvert] as LeadConvert[])
ConvertLeadResponse response = serviceStub.convertLead(convertLead, sessionHeader, null, null,null,null )
LeadConvertResult[] lcr = response.getResult()
//lcr is returning "cannot associate a contact with a consumer account" error
return lcr
}
When code calls convertLead with a Account/Contact combo everything works _fine_, so I'm having issues with convertLead and Person Accounts only.
Shouldn't this be working?
Any ideas, suggestions, greatly appreciated.
Todd
In hopes it saves some agony, the solution is not in the convertLead call as much as it is the Lead field values.
See:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_lead.htm
So, if the lead company field is null, then convertLead call (with null accountid and contactid) will create a Person Account. This will be the solution for me.
All Answers
Thanks for reply, Simon.
Have to admit, I'm confused though.
How do we use convertLead with Person Account?
I found this in the docs:
"If person account record types have been enabled and if the value of the Company field is null, the lead converts to a person account. See “Notes on Converting Leads” in the Salesforce.com online help."
So, I'm setting contact to null thinking that would be the trick.
Thoughts? What am I missing?
The following is also in the docs for convertLead:
"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."
I can successfully call convertLead with:
1) null accountid and contactid which creates new account/contact
2) an existing accountid and contactid
I need to know how to convertLead with a Person Account. The aforementioned error doesn't make sense to me.
Any ideas? Suggestions?
In hopes it saves some agony, the solution is not in the convertLead call as much as it is the Lead field values.
See:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_lead.htm
So, if the lead company field is null, then convertLead call (with null accountid and contactid) will create a Person Account. This will be the solution for me.