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
Buddy ZapataBuddy Zapata 

Converting a Lead - auto-assign existing Account instead of creating new one

Apparently converting a Lead is a very prolific action, it creates an Opportunity, an Account, a Contact, and a Task within the Account.

Ideally I'd like to:
- have it ONLY create the Opportunity/Task
- assign an existing account by ID and NOT create a new Account at all
- not create a new Contact at all

Is Process Builder my only hope here? And if so how would that be done? Thanks

Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi Zapata

You need to baseline the criteria for whic you can identify whether an account record exist or not.Then write a custom lead conversion code and then use the account if it exist.

Cheers!!!
Buddy ZapataBuddy Zapata
I have a specific single account I want to associate all converted Opportunities with a specific Account ID, which I have.

But how am I supposed to accomplish that exactly. What is a "custom lead conversion code"?

This is for the standard Salesforce web UI https://(instance).salesforce.com, so not Apex or anything like that.
Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi Buddy

You need to create an instance of Leadconvert and then set the account Id.

For Instance : 
Database.leadConvert objLeadToConvert = new Database.LeadConvert();
objLeadToConvert.setAccountId(<ACCOUNT_ID>);
objLeadToConvert.setLeadId(<LEAD_ID>);

This piece of code will be called on quickaction.

Cheers!!!
Buddy ZapataBuddy Zapata
Hi where in the Salesforce UI would this code be placed? And how precisely would I navigate to that page in Salesforce?

Again, I'm in the Salesforce UI, so not Apex / Lightning / Canvas / Visualforce.
Syed Insha Jawaid 2Syed Insha Jawaid 2

Hi Buddy Zapata,

This code needs to be added in apex.

Cheers!!!