Yes you have options as below:
- Create a custom page/component which has inputs for lead object. Then have below code in apex:
// fields on myLead object
insert myLead;
Database.LeadConvert lc = new Database.LeadConvert();
lc.setLeadId(myLead.id);
LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
lc.setConvertedStatus(convertStatus.MasterLabel);
Database.LeadConvertResult lcr = Database.convertLead(lc);
System.assert(lcr.isSuccess());
Further read: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dml_convertLead.htm. You have standard methods to get account id and contact id. Also you can programmatically create contact or account and set it.
- Just implement a trigger on lead convert.
trigger LeadConvert on Lead (after update) {
// no bulk processing; will only run from the UI
if (Trigger.new.size() == 1) {
if (Trigger.old[0].isConverted == false && Trigger.new[0].isConverted == true) {
// if a new account was created
if (Trigger.new[0].ConvertedAccountId != null) {
// update the converted account with some text from the lead
Account a = [Select a.Id, a.Description From Account a Where a.Id = :Trigger.new[0].ConvertedAccountId];
a.Description = Trigger.new[0].Name;
update a;
}
// if a new contact was created
if (Trigger.new[0].ConvertedContactId != null) {
// update the converted contact with some text from the lead
Contact c = [Select c.Id, c.Description, c.Name From Contact c Where c.Id = :Trigger.new[0].ConvertedContactId];
c.Description = Trigger.new[0].Name;
update c;
// insert a custom object associated with the contact
MyObject obj = new MyObject();
obj.Name = c.Name;
obj.contact__c = Trigger.new[0].ConvertedContactId;
insert obj;
}
// if a new opportunity was created
if (Trigger.new[0].ConvertedOpportunityId != null) {
// update the converted opportunity with some text from the lead
Opportunity opp = [Select o.Id, o.Description from Opportunity o Where o.Id = :Trigger.new[0].ConvertedOpportunityId];
opp.Description = Trigger.new[0].Name;
update opp;
// add an opportunity line item
OpportunityLineItem oli = new OpportunityLineItem();
oli.OpportunityId = opp.Id;
oli.Quantity = 1;
oli.TotalPrice = 100.00;
oli.PricebookEntryId = [Select p.Id From PricebookEntry p Where CurrencyIsoCode = 'USD' And IsActive = true limit 1].Id;
insert oli;
}
}
}
}
Taken from : https://blog.jeffdouglas.com/2009/02/13/enhancing-the-lead-convert-process-in-salesforce/.
You can also create other custom child objects in lead trigger.