• Raj_Thapar
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

Hi,

 

Is there any way we can export more than 2000 records using Visualforce page to excel sheet?

 

Thanks,

Shruti

Hi all,

 

I'm trying to run a batch process based on a CronKit trigger. The goal of the process is to find all opportunities in a given state and to then create new leads for those opportunities. Everything works fine in the sandbox environment but the governor limits are clamping down on my SOQL even though I limit the number of rows to 100. Any help would be greatly appreciated. 

 

 

public Integer bulkRecycleOpportunities(String opportunityStage) { List<Lead> leadList = new List<Lead>(); if (opportunityStage == OPP_STAGE_CANCEL) { List<Opportunity> opportunityList = new List<Opportunity>([select id, account.yelp_business_id__c, account.business__c, account.business_name__c from opportunity where stageName =:OPP_STAGE_CANCEL and account.last_payment_date__c < LAST_N_DAYS:180 limit 100]); for (Opportunity opportunity:opportunityList) { leadList.add(createLeadFromOpportunity(opportunity)); } } else if (opportunityStage == OPP_STAGE_RECYCLE) { List<Opportunity> opportunityList = new List<Opportunity>([select id, account.yelp_business_id__c, account.business__c, account.business_name__c from opportunity where stageName =:OPP_STAGE_RECYCLE and lastModifiedDate < LAST_N_DAYS:60 limit 100]); for (Opportunity opportunity:opportunityList) { leadList.add(createLeadFromOpportunity(opportunity)); } } insertLeadList(leadList); return leadList.size(); }

 

Here's the full error message in case it helps 

 

 

 

 

Run Failures:bulkRecycler.testCustomBatchTrigger System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, recycleOpportunitiesTrigger: execution of BeforeInsertcaused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing.Even if a field is indexed a filter might still not be selective when:1. The filter value includes null (for instance binding with a list that contains null)2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times)

 


 

 

  • September 29, 2009
  • Like
  • 0