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
pankaj joshi 62pankaj joshi 62 

How to count more than 50000 distinct records

In my org call is child object of account object. I need to count all call records and distinct(accounts) in call object. Call object may have more than 50000 records. Is there a way to achieve this?
This is just off the top of my head, but you could add a number and longtext field to the User object, then use queued or bulk apex, and query those two fields for each set of records.  Add each new, unique account Id to the longtext, and increment the number with each record.

Kind of janky, but might do the trick.