I have tried deep cloning on the opportunity object which has closed won stages it will also clone the Related Products I have tried cloning the opportunity and it works okay,how will i deep clone it?
global void execute(Database.BatchableContext BC, List<Opportunity> scope1){
List<Opportunity> cons = new List<Opportunity>();
//Opportunity op1 = new Opportunity();
for(Opportunity p : Scope1){
if(p.StageName == 'Closed Won' && p.RecordTypeId == '0122v000000vvSPAAY')
{
Opportunity opp=new Opportunity();
opp = p.clone();
insert opp;
}
}
//insertAccountsAndContacts(op1);
}