function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AdrianCCAdrianCC 

Lead Convert: How does the merge with existing Account/Contact work?

Hi all!

 

Just a couple of quick questions guy, if you can help me...

 

1. is there a way in apex when converting a Lead with convertLead DML to not create a contact? I just want the account and the oppty, no contact. Is this possible through config?

 

2. when setting the Account id and Contact id for a merge, with setAccountId() and setContactId() how does the merge function? Is it an update call on those 2 records? Are only the fields from the mapping copied over? 

 

3. Can I manually convert a Lead in apex code, without using convertLead? I'm thinking of manually creating the Acc and Oppty from it and then updating the ncessary fields on the Lead, like 

  • ConvertedAccountId
  • ConvertedDate
  • ConvertedOpportunityId
  • IsConverted
  • Status

Is this possible?

 

4. Is there any way to modify the convert page? I would like to give the user the choice of creating a new Account of a certain RecType, merging with an existing one(and only copy over some fields) or search an external service for an existing  Account and copy the info for it from there...( :) I know, I want a lot!)

 

Thanks,
Adrian

AdrianCCAdrianCC

So I think I'll answer myself - eu centrez, eu dau cu capul :)

I've tested or found answers for my questions meanwhile.

 

1. create a checkbox on the lead, like 'Do Not Convert To Contact', and use a trigger to delete the created contact afterwards

 

2. merge is just like the name says merge, the only field values copied are the ones from the Lead to those in Acc/Con that are blank(null). So for example fieldx on Acc will get a value from the Lead only if it's null in the start.

 

3. nope! you gotta use convertLead!

 

4. again no! Best way is to go with a custom VF page

 

Adrian

Ron KikerRon Kiker
I realize this is a bit late, but concerning item 3, you can "convert" a lead without using convertLead.  convertLead is just a process.  You can do the same thing in Apex, but you would have to go through each step of the process and introduce your own customization.  It's certainly not impossible. ConvertLead is made available for convenience, however, it's not a required solution.