You need to sign in to do that
Don't have an account?
manoj6492
bulk trigger for updating
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; } if(trigger.isDelete) { AccountOne__c a3 = [Select Id from AccountOne__c where Name =: trigger.old[0].Name ]; delete a3; } }
the above trigger handles only single record but i need to handle it for bulk records...can anyone help me
Since you are creating one AccountOne__c per account, why arent making AccountOne__c child of standard account ?
This way it will be really easy to handle the sync. Infact you can create formula fields in chaild for Fax,Phone etc that will automatically reflect values from Account
I have been given task to do by this way