Find your content:

Search form

You are here

Can I programmatically merge Leads to existing Accounts?


We just discovered that we imported duplicate data into SFDC and have ~200 Leads with duplicate Accounts. I know that I can manually merge these objects in the UI by choosing to merge the Lead to an existing Account, but that would be very time consuming and tedious.

I see the merge() function only allows this with like objects (Leads with Leads, Accounts with Accounts).

Can this be done programmatically through the API?


Attribution to: Mike Chale

Possible Suggestion/Solution #1

Check out - The application allows you to view Leads, Contacts, Accounts in a single view. It's also free if you're just looking at your own data and don't leverage enrichment or email validation functions.

Attribution to: Alex

Possible Suggestion/Solution #2

Yes, heres a sample from

Lead myLead = new Lead(LastName = 'Fry', Company='Fry And Sons');
insert myLead;

Database.LeadConvert lc = new     database.LeadConvert();

lc.setAccountId(SET ACCOUNT ID);

Database.LeadConvertResult lcr =     Database.convertLead(lc);

Attribution to: techtrekker
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content