You need to sign in to do that
Don't have an account?
srikanth n
How to get a count records from object?
How to get a count records from object? ex:- if i have 1 lakh records in object
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Hey Srikanth,
1) Open the Developer Console, In Query Editor & execute simple query as "SELECT id FROM Acccount", you will get the number of record in Query Results.
2) If you want to use this count in Code, you can write query as
Integer count = SELECT count() FROM ObjectName;
Check count you will get number of records from object,
Happy coding!!
If its not those use cases, then I have seen people use custom objects or custom settings to hold the counts of certain objects and then run Batch (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_batch_interface.htm) jobs every hour, day, week, whatever to update those counts.
You can use Batch Apex class to get the all the records. you have to set batch size.
1. Perform a fast lookup with your required filters
2. Assign the record count to a sObject collections variable. (in screenshot: nofCases)
3. Use a Assignment step, to assign the variable to a number variable. (Point to note: the assignment variable should be of type number only to make use of equals count operator. In the screenshot, this is called testCount)
4. Voila! the testCount variable is a count of the records you are searching for. Play with it.
If this helped anyone here, dont forget to hit the thumbs up.
Cheers!!
Roy
it will give you the total number of records of object
hope this helps you