I need to convert Leads into just an Opportunity because for various reasons the Account and Contacts for the Lead record will have been created separately. From the convertLead() docs is seems that if you use this method then you have to create an Account and Contact record on conversion.

Use convertLead() to convert a Lead into an Account and Contact, as well as (optionally) an Opportunity.

Is this correct?

If so, then I would have to create the Opportunity separately which is fine except that I still need to mark the Lead as converted, but I see that the isConverted field is non-writable.

Would really like to find out about methods to convert a Lead into just an Opportunity and whether I can explicitly set a Lead to isConverted by code.

1 Answer 1


Take a look at the documentation:

There you have the ability to provide an existing AccountId and ContactId with the methods setAccountId() and setContactId(), respectively.

You just have to make sure that your contact is associated with the account you provide in AccountId, and if you use PersonAccounts, don't provide the ContactId

setAccountId Sets the ID of the account into which the lead will be merged. This value is required only when updating an existing account, including person accounts. Otherwise, if setAccountID is specified, a new account is created.

setContactId Sets the ID of the contact into which the lead will be merged (this contact must be associated with the account specified with setAccountId, and setAccountId must be specified). This value is required only when updating an existing contact.Important If you are converting a lead into a person account, do not specify setContactId or an error will result. Specify only setAccountId of the person account. If setContactID is specified, then the application creates a new contact that is implicitly associated with the account.

  • Ah. Of course. I read that a few times, but for some reason I completely blanked. Thanks for the help.
    – Joe
    Feb 21, 2013 at 15:37
  • please mark my answer as correct, so other people with the same question will later on discover it easily ;) and an upvote would also be appreciated.
    – pjcarly
    Feb 21, 2013 at 15:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .