+ Start a Discussion

Please help to correct the mass clone record with attachment trigger1



I am mass cloning the record and for mass cloning the attachment i have written the trigger but its cloning the attachment of first record only and i want to mass clone the attachment with record also.


Can anyone please help me to resolve mu problem .Help will really appriciated.Please find attached my trigger below.What changes needed to do for mass cloning the attachment also.


trigger CopyAttachments on New_Support__c(after insert)
List<Id> parentIds=new List<Id>();
Attachment[] attList = [select id, name, body from Attachment where ParentId = :Trigger.new[0].Parent_New_Support__c];
Attachment[] insertAttList = new Attachment[]{};

for(Attachment a: attList)
Attachment att = new Attachment(name = a.name, body = a.body, parentid = Trigger.new[0].id);
if(insertAttList.size() > 0)
insert insertAttList;



Thanks in advance:-)


This is a cross post from the apex board.  Please don't do this.


K sure bob.


Can you please give me any idea to resolve my problem.



Thanks in advance for your help.