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

formula field to count

hi is it possible to create a field on a custom object which gives the count of Accounts.Like this object should display all the numerical data.


field ---> Num Accounts  ---> should give the count of all accounts in the org.


I know reports help us to get this info But i need to get this for some other purpose.

Steve :-/Steve :-/

The Account object is an "Ultimate Parent" it cannot have a Master-Detail relationship to another SFDC Object.  

You might have a shot if you create a custom Analytic Snapshot object, but I think that might be a Dead End.


yup thats what i am thinking to do to create a custom object.But how to create  a field that gets updated by number of accounts.


one way i am thinking is to create a trigger oin account to like whenever an account is modifed it should fire the trigger to update the number of accounts filed by giving the count.Is it possible.


I've done something similiar in my org.  I have a custom object called Groups.  The account object has a lookup field to the Groups object. 


I have a trigger on Account which automatically populates the lookup field everytime an account is created (so there are no null values).


Then I have a trigger that acts like a roll-up summary field to count all the accounts related to the group record.


Maybe something like this could work for your situation.


Good luck!