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
Mani RenusMani Renus 

Write a trigger if a account is created then it count and display count field in another object..

How can we achieve this??
sweetzsweetz
You want no of accounts created count in another related object ?
Abhi_TripathiAbhi_Tripathi
Hey,

You can use aggregate query to count the records and then assign the value to the field

//this will return number of records
List<Account> accounts = [Select Count() From Account];


Regards,
Abhi Tripathi
Salesforce Developer