function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kishore cmxkishore cmx 

I created total number contacts field in contact object?when i update or create a contact the total cotacts number will be displayed on that filed(How to write a trigger) plz exlain each step?

surasura
well are you going to update that field of each contact record when you add a new contact record ?, well that is not a good idea at all , why dont use count() function to get the total number of contacts.
 
integer totalcontacts = [sELECT count() from contact];

 
kishore cmxkishore cmx
plz write trigger?
 
surasura
writing trigger will not work for your requirment as number of contacts grow ,

just think of the implications of updating every contact records  total number field every time a contact is created .