1

i tried below resolutions but no any worked...

REsolution:

If your controller does not have any DML operation than you can easily solve above two salesforce governer limits using the attribute readOnly="true" by default it's value is false.

  1. Query Rows limits increased from 50001 to 1 million rows
  2. collection size limits increased from 1001 to 10,000

  3. // Return the number of ad book clients public string getClientAccountCount() { System.debug(LoggingLevel.Debug, 'getClientAccountCount() - Current Query Rows: ' + Limits.getQueryRows() + '/' + Limits.getLimitQueryRows()); integer recordCount = [Select count() from Account where SomeCustomField__c = 'Client' limit 1001]; if(recordCount == 1001) { return '1000+'; } return string.valueOf(recordCount); }

3.Integer limitRows = Limits.getLimitQueryRows() - Limits.getQueryRows(); 2 List accnts = [select id from account limit :limitRows];

here is my code:

private List<AggregateResult> getTaskList() {
taskList = new List<AggregateResult>();
if(isFirstTime) {
  if(Test.isRunningTest()) {
    taskList = [Select count(id) total, Object_Name__c, WhatId  From Task t where (t.Status = 'In Progress' OR t.Status = 'Not Started') 
        AND t.Trial_Id__c =:asp.id AND t.WhatId != null and Subject != 'Resubmit Rejected CRF' and subject NOT IN ('Schedule the patient for a core biopsy', 'Schedule the patient for a blood sample', 'Schedule the patient for a MRI scan', 'Schedule a clinic appointment for Response Evaluation CRF','Schedule a clinic appointment after randomization', 'Schedule Treatment Phase', 'Schedule the patient for a lab visit', 'Schedule a clinic appointment for Followup CRF') 
        group by t.WhatId, t.Object_Name__c limit 1];
  } else {
    **taskList = [Select count(id) total, Object_Name__c, WhatId  From Task t where (t.Status = 'In Progress' OR t.Status = 'Not Started') 
        AND t.Trial_Id__c =:asp.id AND t.WhatId != null and Subject != 'Resubmit Rejected CRF' and subject NOT IN ('Schedule the patient for a core biopsy', 'Schedule the patient for a blood sample', 'Schedule the patient for a MRI scan', 'Schedule a clinic appointment for Response Evaluation CRF','Schedule a clinic appointment after randomization', 'Schedule Treatment Phase', 'Schedule the patient for a lab visit', 'Schedule a clinic appointment for Followup CRF') 
        group by t.WhatId, t.Object_Name__c ];**
  }
  isFirstTime = false;
  system.debug('isFirstTime: '+isFirstTime);
} else {
  string queryStrValue = 'Select count(id) total, Object_Name__c, WhatId From Task t ';
  if(selectedCRFViewOption == 'pending submission'){
    //queryStrValue = queryStrValue + 'where (t.Status = \'In Progress\' OR t.Status = \'Not Started\') AND t.Trial_Id__c != null AND t.WhatId != null AND t.OwnerId = \''+UserInfo.getUserId()+'\' group by t.Object_Name__c ';
    queryStrValue = queryStrValue + 'where (t.Status = \'In Progress\' OR t.Status = \'Not Started\') AND t.Trial_Id__c = \''+asp.id+'\' and Subject != \'Resubmit Rejected CRF\' AND t.WhatId != null and subject NOT IN (\'Schedule the patient for a core biopsy\', \'Schedule the patient for a blood sample\', \'Schedule the patient for a MRI scan\', \'Schedule a clinic appointment for Response Evaluation CRF\', \'Schedule a clinic appointment after randomization\', \'Schedule Treatment Phase\', \'Schedule the patient for a lab visit\', \'Schedule a clinic appointment for Followup CRF\') group by t.Object_Name__c, WhatId ';
    showTabPanel = true;
    system.debug('queryStrValue pending submission: '+queryStrValue);
  }else if(selectedCRFViewOption == 'pending re-submission'){
    //queryStrValue = queryStrValue + 'where (t.Status = \'In Progress\' OR t.Status = \'Not Started\') AND Subject = \'Resubmit Rejected CRF\' AND CRF__c != null AND Trial_Id__c != null AND WhatId != null AND OwnerId = \''+UserInfo.getUserId()+'\' group by t.Object_Name__c ';
    //queryStrValue = queryStrValue + 'where (t.Status = \'In Progress\' OR t.Status = \'Not Started\') AND Subject = \'Resubmit Rejected CRF\' AND CRF__c != null AND Trial_Id__c =\''+asp.id+'\' group by t.Object_Name__c, WhatId ';
    queryStrValue = queryStrValue + 'where (t.Status = \'In Progress\' OR t.Status = \'Not Started\') AND Subject = \'Resubmit Rejected CRF\' AND Trial_Id__c =\''+asp.id+'\' group by t.Object_Name__c, WhatId ';
    showTabPanel = true;
  }else if(selectedCRFViewOption == 'Patients pending registration'){
    //queryStrValue = queryStrValue + 'where Object_Name__c = \'Registration__c\' AND (Status = \'In Progress\' OR Status = \'Not Started\') AND Trial_Id__c != null AND WhatId != null AND OwnerId = \''+UserInfo.getUserId()+'\' group by t.Object_Name__c ';
    queryStrValue = queryStrValue + 'where Object_Name__c = \'Registration__c\' AND (Status = \'In Progress\' OR Status = \'Not Started\') AND Trial_Id__c =\''+asp.id+'\' AND WhatId != null group by t.Object_Name__c, WhatId ';
    showTabPanel = false;
    crfFormName = CRFFormsMap.get('Registration__c');
    crfFormApiName = CRFFormTypeMap.get(crfFormName);
    Apexpages.currentPage().getParameters().put('CRFName','Registration__c');
    CRFPendingListsView();

  }else if (selectedCRFViewOption == 'Delayed CRFs'){
    //queryStrValue = queryStrValue + 'where (t.Status = \'In Progress\' OR t.Status = \'Not Started\') AND t.Trial_Id__c != null AND t.WhatId != null AND t.OwnerId = \''+UserInfo.getUserId()+'\' AND t.Original_Due_Date__c < TODAY group by t.Object_Name__c ';
    queryStrValue = queryStrValue + 'where (t.Status = \'In Progress\' OR t.Status = \'Not Started\') AND t.Trial_Id__c =\''+asp.id+'\' AND t.WhatId != null AND t.Original_Due_Date__c < TODAY and subject NOT IN (\'Schedule the patient for a core biopsy\', \'Schedule the patient for a blood sample\', \'Schedule the patient for a MRI scan\', \'Schedule a clinic appointment for Response Evaluation CRF\', \'Schedule a clinic appointment after randomization\', \'Schedule Treatment Phase\', \'Schedule the patient for a lab visit\', \'Schedule a clinic appointment for Followup CRF\') group by t.Object_Name__c, WhatId ';
    showTabPanel = true;  
  }else{
    System.debug('selectedCRFViewOption--------else----'+selectedCRFViewOption);
    queryStrValue = queryStrValue + 'where (Status = \'In Progress\' OR Status = \'Not Started\') AND Object_Name__c = \''+selectedCRFViewOption+'\' AND Trial_Id__c != null AND WhatId != null group by t.Object_Name__c, WhatId ';
    showTabPanel = false;
    crfFormName = CRFFormsMap.get(selectedCRFViewOption);
    crfFormApiName = CRFFormTypeMap.get(crfFormName);
  }

  System.debug('queryStrValue--------------'+queryStrValue);
  if(Test.isRunningTest()) {
    queryStrValue+= ' limit 1';
  }
  taskList = Database.query(queryStrValue);
}

System.debug('taskList-----------'+taskList);

return taskList;
  } 

Please help me out in this....bold soql is where i am getting error....

4
  • Similar kind of thread - salesforce.stackexchange.com/questions/40916/… Commented Oct 13, 2014 at 11:30
  • Hey pramod as i checked your mentioned link..as i added where clause to reduce the number of records..do u have any other solution which will help me out...?
    – sumit
    Commented Oct 13, 2014 at 11:41
  • Maybe you could use the readOnly annotatio: salesforce.com/us/developer/docs/apexcode/Content/… Commented Oct 13, 2014 at 13:21
  • hey pramodand lex, its resolved now...with readonly="true" condition on the page...i used this as my first solution but i wrongly puted in another page which is similar to this.... anyways thatnks for your help.... regards, Kalpesh
    – sumit
    Commented Oct 13, 2014 at 13:31

1 Answer 1

3

If your controller does not have any DML operation than you can easily solve above two salesforce governer limits using the attribute readOnly="true" by default it's value is false.

  1. Query Rows limits increased from 50001 to 1 million rows
  2. collection size limits increased from 1001 to 10,000

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .