I have below execute method of an apex batch class where I need to clone Question_Response_vod__c records of existing with changes in few fields. Can someone please guide me here. I have in code to create but not getting how to clone.
Apex Class snippet
List<Question_Response_vod__c> s2q1rListToInsert = new List<Question_Response_vod__c>();
for(Question_Response_vod__c s1q1r : [Select Id,Survey_Question_vod__c,Text_vod__c from Question_Response_vod__c where Survey_Question_vod__c in : s1qlist])
{
s2q1rListToInsert.add(new Question_Response_vod__c(Survey_Question_vod__c=s1qs2qMap.get(s1q1r.Survey_Question_vod__c),Text_vod__c=s1q1r.Text_vod__c)); // Need to clone with changes in mentioned fields.
}
If(s2q1rListToInsert.size()>0)
Insert s2q1rListToInsert;
s2q1rListToInsert
list? or s1q1r ? – Ratan Paul May 5 '16 at 7:16