Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Hi,
How to find the count of account records if there are more than 2 lakh records?
Thanks,
Malar
Hi Malar,
we cannot get the count if org has more than 50000 records, we will get Too many query rows exception.
Idea is we need to break the calls.
or
it is possible through the VF Page workarounds.
also I have got other work around in vf page using JavaScript Query.
try this.
put the below code in your vf page. you can see the count of records, if this workaround will work for you, pass the value to your controller.
<apex:page > <script type="text/javascript"> var __sfdcSessionId = '{!GETSESSIONID()}'; </script> <script src="../../soap/ajax/22.0/connection.js" type="text/javascript"></script> <script type="text/javascript"> window.onload = setupPage; function setupPage() { var state = { output : document.getElementById("output"), startTime : new Date().getTime()}; var callback = {onSuccess: layoutResults,onFailure: queryFailed,source: state}; sforce.connection.queryAll("Select Id, Name From Account ",callback); } function queryFailed(error, source) { source.output.innerHTML = "An error has occurred: " + error; } function layoutResults(queryResult, source) { output = queryResult.size +" "; source.output.innerHTML = output; } </script> <div id="output"> </div> </apex:page>
Hi Malar,
we cannot get the count if org has more than 50000 records, we will get Too many query rows exception.
Idea is we need to break the calls.
or
it is possible through the VF Page workarounds.
also I have got other work around in vf page using JavaScript Query.
try this.
put the below code in your vf page. you can see the count of records, if this workaround will work for you, pass the value to your controller.