If in your Salesforce Implementation, you are dealing with both individual and group accounts, then with the release of Spring 21, now you can link your converted leads into both individual and group accounts with the new LeadConvert Methods.
Note
This feature is only available in Enterprise, Performance, and Unlimted Editions.
The new LeadConvert methods will allow you to link converted leads into a business and person account instead of a contact. Below are the methods available –
getRelatedPersonAccountId() – Gets the Id of an existing person account to convert the lead into.
setRelatedPersonAccountId(String personAccountId) – Sets the Id of an existing person accoung to convert the lead into.
getRelatedPersonAccountRecord() – Gets the entity record of a new person account to convert the lead into.
setRelatedPersonAccountRecord(Entity relatedPersonAccountRecord) – Sets the entity record of a new person account to convert the lead into.
LeadConvertResult class holds the result of the lead conversion.
Example 1
The below example uses the existing personAccountId to convert the lead into. After the execution of this method, lead with id leadIdwill be converted into both business account with id businessAccountIdand person account with id personAccountId.
The below example created a new person account to convert the lead into. After the execution of this method, lead with id leadIdwill be converted into both business account with id businessAccountIdand a new person account will be created, which will then be used to convert the lead into.