trigger AccountReplicate on Account (after delete, after insert, after update) {
if ( trigger.isInsert ) {
for ( Account acc : trigger.new ) {
AccountOne__c ac = new AccountOne__c();
ac.Fax__c = acc.Fax;
ac.Phone__c = acc.Phone;
ac.Name =acc.Name;
insert ac;
}
}
if ( trigger.isUpdate ) {
integer i = 0;
list<AccountOne__c> a2 = new list<AccountOne__c>([SELECT Id
FROM AccountOne__c
WHERE Name =: trigger.old[i].Name ]);
for ( AccountOne__c c1 : a2 ) {
c1.Name = trigger.new[i].name;
c1.Fax__C = trigger.new[i].Fax;
c1.Phone__C = trigger.new[i].Phone;
i++;
}
update a2;
}
}
I tried bulk trigger for the update operation, but it's not working can anyone help me?