Skip to main content
code formatting, added missing closing bracket
Source Link
JCD
  • 3.4k
  • 2
  • 27
  • 37
      `triggertrigger 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;
    }`
}

iI tried bulk trigger for the update operation  ,but its but it's not working can anyone help me?

      `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 its not working can anyone help me

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?

deleted 150 characters in body
Source Link
Manoj Chandran
  • 1.2k
  • 4
  • 26
  • 56
 if (trigger.isUpdate) {
     integer  i = 0;
     list<AccountOne__c>`trigger a2AccountReplicate =on newAccount list<AccountOne__c>([SELECT Id 
   after delete, after insert, after update)         {

    if(trigger.isInsert)
    {
       for (Account acc:trigger.new)
        {
          AccountOne__c ac = FROMnew AccountOne__c ();
                                                       WHERE Nameac.Fax__c = trigger.old[i]acc.Name]);Fax;
     for (AccountOne__c c1 : a2) {    
         c1ac.NamePhone__c = trigger.new[i]acc.name;Phone;
         c1.Fax__C = triggerac.new[i]Name =acc.Fax;Name;
         c1.Phone__C = trigger.new[i].Phone;
    insert ac;
    i++;
     }
     
 update a2;
 }

  
 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 its not working can anyone help me

 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.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 its not working can anyone help me

      `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 its not working can anyone help me

 `triggerif AccountReplicate(trigger.isUpdate) on{
 Account (after delete, after insert,integer after update)i {
= 0;
  if   list<AccountOne__c> a2 = new list<AccountOne__c>([SELECT Id 
                                                       FROM AccountOne__c 
                                                       WHERE Name = trigger.isInsertold[i].Name]);
  {
   for (AccountAccountOne__c accc1 :trigger.new)
 a2) {    
    AccountOne__c ac = new AccountOne__c(); c1.Name = trigger.new[i].name;
    ac     c1.Fax__cFax__C = acctrigger.new[i].Fax;
    ac     c1.Phone__cPhone__C = acctrigger.new[i].Phone;
    ac.Name =acc.Name;    i++;
    insert ac;
}
     update a2;
 }

`

 
`if if (trigger.isUpdate)
  {
     integer  i=0;i = 0;
     list<AccountOne__c> a2 = new list<AccountOne__c>([Select[SELECT Id from
                                                       FROM AccountOne__c where
                                                       WHERE Name =: trigger.old[i].Name ]); 
     for (AccountOne__c c1 : a2)
{   
 {
    
      c1.Name=triggerName = trigger.new[i].name;
         c1.Fax__C =trigger= trigger.new[i].Fax;
         c1.Phone__C=triggerPhone__C = trigger.new[i].Phone;
         i++;
     }
     update a2;
    }`

i tried bulk trigger for the update operation ,but its not working can anyone help me

 `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 its not working can anyone help me

 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.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 its not working can anyone help me

added 361 characters in body
Source Link
Manoj Chandran
  • 1.2k
  • 4
  • 26
  • 56
Loading
Source Link
Manoj Chandran
  • 1.2k
  • 4
  • 26
  • 56
Loading