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
KRaviKRavi 

Function to calculate sum of 200,000 records at once

I've to create a function which can calcuate sum(POtotal) from PODetail object and EMail the result to provided EMail ID
calculateTotalPO(string ToEmail, string Fieldname,string objname)

this function should handle more than 100,000 records
how do i achieve this, bcoz in a SOQL query i cannot retrieve more than 50,000 records at a time.
but in our object we have moer than 200,0000 records

do assist me in creating this function to handle more than 200,000 records and send an Email 
 
AshlekhAshlekh
Hi,

You have to wirte a batch call for this and calculate the value and then in last finish method you can send an email to user.

-Thanks
'Ashlekh Gera