How to Convert Leads to a Person and Business Account at the Same Time | Spring 21 New Feature
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.VideoIf you prefer video, here is the youtube video MethodsThe 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 1The below example uses the existing personAccountId to convert the lead into. After the execution of this method, lead with id leadId will be converted into both business account with id businessAccountId and person account with id personAccountId.public static void convertLeadWithExistingPersonAccount(String leadId, String businessAccountId, String personAccountId, String opportunityId) { Database.LeadConvert lc = new Database.LeadConvert(); lc.setLeadId(leadId); lc.setAccountId(businessAccountId); //New Method to use the existing person account id to convert the lead into. lc.setRelatedPersonAccountId(personAccountId); lc.setOpportunityId(opportunityId); lc.setSendNotificationEmail(false); LeadStatus convertStatus = [SELECT ...
Read More