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
Saurabh Kumar 284Saurabh Kumar 284 

Create a field on Account object

Create a field on Account object:
Field Label: Number OF Contacts
Data Type: Number (2,0)
Visible to All Profiles and Add it to the Page Layouts.
Write an apex trigger to populate the new field in case if Account undergoes any update with Count of Contact records under it. Example: Account "ABC Corp" has 3 contacts. I update this account record today, new field should have a value of 3. If I create a new account then this field should have value as 0. If now I create a contact under it, count should be increased to 1. If I delete a contact, the count should be reduced by 1.
Banwari KevatBanwari Kevat
Hi Saurabh,
   Please follow the below link