What Happens When A Lead Is Converted?
understanding Lead Conversion:
When you convert a lead, Salesforce creates a new account, contact, and, optionally, an opportunity using the information from the lead. Any campaign members are moved to the new contact and the lead becomes read only. If an existing account and contact have the same names as those specified on the lead, you can choose to update the existing account and contact. Information from the lead is inserted only into blank fields; Salesforce does not overwrite existing account and contact data.
All open and closed activities from the lead are attached to the account, contact, and opportunity. You can assign the owner of the records, and schedule a follow-up task. When you assign a new owner, only the open activities are assigned to the new owner. If you have custom lead fields, that information can be inserted into custom account, contact, or opportunity fields. Converted leads can't be viewed, although they appear in lead reports. Salesforce updates the Last Modified Date and Last Modified By system fields on converted leads when picklist values included on converted leads are changed.
Consider the following when converting leads.
Campaigns: If the lead matches an existing contact and both records are linked to the same campaign, the campaign member status is determined by whichever is further along in the lifecycle of the campaign. For example, if the lead member status is “sent” and the contact member status is “responded,” the responded value is applied to the contact. Related campaign information is always associated with the new contact record, regardless of the user's sharing access to the campaign.
When more than one campaign is associated with a lead, the most recently associated campaign is applied to the Primary Campaign Source field on the opportunity, regardless of the user's sharing access to the campaign.
Chatter: When you convert a lead into an existing account, you don’t automatically follow that account. However, when you convert the lead into a new account, you automatically follow the new account, unless you disabled feed tracking for accounts in your Chatter settings.
Data.com / D&B Company: If you use Data.com Premium, when you add a lead from Data.com, a corresponding D&B Company record (if one exists in Data.com) is automatically created in Salesforce and linked to the lead record via its D&B Company field. If you later convert that lead: If the account is created from the conversion, the lead’s Company D-U-N-S Number field value transfers to the account’s D-U-N-S Number field, and the lead’s D&B Company field value transfers to the account’s D&B Company field. The lead’s Data.com Key field value transfers to the contact’s Data.com Key field. If you use Data.com Corporate, no D&B Company record is created, but the lead’s Data.com Key field value transfers to the contact’s Data.com Key field.
Divisions: The new account, contact, and opportunity are assigned to the same division as the lead. If you update an existing account during lead conversion, the account’s division is not changed, and the new contact and opportunity inherit the account’s division. Existing Contact When you update an existing contact with a lead that you are converting, lead information in multi-select picklist fields carries over to the existing contact only if the matching fields for the contact are blank.
Local Lead Names The Company Name (Local) on the lead automatically maps to Account Name (Local), along with their associated standard name fields.
Person Accounts If your organization uses person accounts, you can convert leads to either person accounts or business accounts. Leads with a blank Company field are converted to person accounts. The default person account record type for your profile is applied to the new person account. Note that you can only create leads with a blank Company field using the Force.com API. Leads with a value in the Company field are converted to business accounts. The default business account record type for your profile is applied to the new business account. As a best practice, use different lead record types and page layouts to differentiate leads that will be converted to person accounts from those that will be converted to business accounts. In particular, remove the Company field from the page layouts of leads that will be converted to person accounts, and make the Company field required on the page layouts of leads that will be converted to business accounts.
If you create a lead, convert it, and then attach it to a person account owned by someone else, the person account owner becomes the contact owner.
If you convert a lead owned by someone else and attach it to a person account that you own, the lead owner becomes the contact owner.
Record Types: If the lead has a record type, the default record type of the user converting the lead is assigned to records created during lead conversion. The default record type of the user converting the lead determines the lead source values available during conversion. If the desired lead source values are not available, add the values to the default record type of the user converting the lead.
Salesforce to Salesforce: When you convert a lead, Salesforce to Salesforce inactivates the shared record and updates the External Sharing related list in your connection's lead record with an Inactive (converted) status. Due to inactivation of the shared record, changes to the Lead Status during conversion aren't reflected in your connection's lead record. Standard and Custom Lead Fields The system automatically maps standard lead fields to standard account, contact, and opportunity fields. For custom lead fields, your administrator can specify how they map to custom account, contact, and opportunity fields.
The system assigns the default picklist values for the account, contact, and opportunity when mapping standard lead picklist fields that are blank. If your organization uses record types, blank values are replaced with the default picklist values of the new record owner.
Territory Management: If your organization uses territory management, the new account is evaluated by account assignment rules and may be assigned to one or more territories. If the rules assign the account to exactly one territory, then the opportunity will also be assigned to that territory. If the rules assign the account to multiple territories, then the opportunity is not assigned to any territory.
Triggers: During lead convert, Apex triggers are fired, and universally required custom fields and validation rules are enforced, only if validation and triggers for lead convert are enabled in your organization.
Salesforce ignores lookup filters when converting leads if the Enforce Validation and Triggers from Lead Convert checkbox on the Lead Settings page is deselected.
Workflow: You can’t convert a lead that’s associated with an active approval process or has pending workflow actions. Converting a lead to a person account won’t trigger workflow rules.
When a lead is converted by someone who isn't the lead owner, all workflow tasks associated with the lead that are assigned to that user, except email alerts, are reassigned to the lead owner. Workflow tasks assigned to users other than the lead owner and lead converter aren't changed.
The conversion is a standard salesforce functionality that does the actions in your question. On top of that you can customise the conversion process by adding workflows or triggers on top of it.
When converting, standard lead fields map automatically into standard fields on the other objects - see this. You can also map your own custom fields as documented here.
If you want to build your own custom logic then you'll need to write a trigger on the lead object:
trigger LeadTrigger on Lead (before update)
{
for(Lead lead : trigger.new)
{
if (Lead.IsConverted)
{
// do something with the converted leads
}
}
}
Additionally, you can programmatically convert leads in your apex code - see this answer