Skip to main content
iam account and contact in account object iam having phonenumber=9999999999 and i need to update all contact mobilephone feild which are accosiated particular account i done with follwing code no error bt trigger not firing pls hlp....

trigger accountupdatetrigger on account (after update) {

    if(trigger.isafter)

    {

        if(trigger.isupdate)

        {

   list<contact> lst = new list<contact>();

            

    

  list <Account> a = [Select id,Name,phone, (Select id, Contact.FirstName,contact.LastName,contact.MobilePhone from Account.Contacts) From Account where phone ='99999999999'];

       

            

            for(Account acc1:a)

               {

                   

                 for(schema.Contact cn:acc1.Contacts)

                     

                       {

                         //  lst.add(cn);

                      // }

                           

                          // if(cn.MobilePhone!=null && cn.MobilePhone==null)

                          // {

                           cn.MobilePhone ='99999999999';

                          update cn;

                           

                           }            

                           

       }

    }

              

}

       

    }
2 answers
  1. Apr 18, 2016, 2:37 PM
    when you updating we must pass id but above code not passing id how it is possible?

     
0/9000