We have standard clone button where we can clone only lead record, what if we need to clone all the child records and attachments along with Lead then apex is only options. 1. Define Quick Action "Clone", call lightning component. 2. Change layout add custom clone button in the place of Standard clone button. We have to make sure, if any custom fields added in Lead in future then cloned should have that new field populated and should be able to be converted. That being said we cant hardcode field name. We have to make it dynamic. Here is code block to get all fields dynamically in SOQL. // This is the set where all fields name will be stored Set < String > fieldNames = new Set < String > (); Map < String , Schema.SObjectField > fieldMap = Lead.sObjectType.getDescribe().fields.getMap(); // Get all of the fields on the...
A place where you have to land for exploring Salesforce