You need to sign in to do that
Don't have an account?

URGENT: Have problem in scheduled batch class
Hi,
I have a daily scheduled batch class. But while execution it is throwing "Internal Salesforce Error". Can anyone help me on this. Here is my source code and getting error at highlighted line.
global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator('Select Id from User where IsActive = true');
}
global void execute(Database.BatchableContext BC, List<sObject> scope){
for(sobject s : scope){
User userRec = (User)s;
List<Campaign_User__c> campUserList = [Select Campaign__c from Campaign_User__c where User__c =: userRec.Id limit 10000];
Set<Id> campUserIds = new Set<Id>();
for(Campaign_User__c CU: campUserList)
{
campUserIds.add(CU.Campaign__c);
}
List<Member__c> updatemembList = new List<Member__c>();
String buyerRecordTypeId = Schema.Sobjecttype.Account.getRecordTypeInfosByName().get('Buyer').getRecordTypeId();
//Map<id,account> aMap = new Map<id,account>([Select Id,Name from Account where recordTypeId =: buyerRecordTypeId AND Camp_Rec_Count__c > 0 limit 50000]);
List<account> acctList = [Select Id,Name from Account where recordTypeId =: buyerRecordTypeId AND Camp_Rec_Count__c > 0 limit 20000];
Set<id> accIds = new Set<id>();
for(Account acc : acctList)
{
accIds.add(acc.Id);
}
// Map<id,Campaign__c> cMap = new Map<id,Campaign__c>();
List<Campaign__c> campList =[Select Id, Name, Accounts__c,Campaign_Project__c,Accounts__r.Name from Campaign__c where Id in: campUserIds AND Accounts__c in: accIds AND Type__c = 'Telemarketing' order by createdDate Desc limit 25000];
Set<id> campIds = new Set<id>();
for(Campaign__c camp: campList)
{
campIds.add(camp.id);
}
List<Member__c> membList = [Select Id, Status__c, Company__c, Contact__c, Contact__r.AccountId, Assigned_Date__c, Campaign__c from Member__c where Campaign__c in: campIds AND Status__c != 'Assigned' AND Status__c != 'Closed' ORDER BY Assigned_Date__c Desc limit 20000];
List<Task> openTasks = [Select Id from Task where OwnerId =: userRec.Id AND Campaign_Member_Id__c != null AND Status != 'Completed' limit 200];
Integer recCount = openTasks.size();
recCount = 200 - recCount;
I have a daily scheduled batch class. But while execution it is throwing "Internal Salesforce Error". Can anyone help me on this. Here is my source code and getting error at highlighted line.
global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator('Select Id from User where IsActive = true');
}
global void execute(Database.BatchableContext BC, List<sObject> scope){
for(sobject s : scope){
User userRec = (User)s;
List<Campaign_User__c> campUserList = [Select Campaign__c from Campaign_User__c where User__c =: userRec.Id limit 10000];
Set<Id> campUserIds = new Set<Id>();
for(Campaign_User__c CU: campUserList)
{
campUserIds.add(CU.Campaign__c);
}
List<Member__c> updatemembList = new List<Member__c>();
String buyerRecordTypeId = Schema.Sobjecttype.Account.getRecordTypeInfosByName().get('Buyer').getRecordTypeId();
//Map<id,account> aMap = new Map<id,account>([Select Id,Name from Account where recordTypeId =: buyerRecordTypeId AND Camp_Rec_Count__c > 0 limit 50000]);
List<account> acctList = [Select Id,Name from Account where recordTypeId =: buyerRecordTypeId AND Camp_Rec_Count__c > 0 limit 20000];
Set<id> accIds = new Set<id>();
for(Account acc : acctList)
{
accIds.add(acc.Id);
}
// Map<id,Campaign__c> cMap = new Map<id,Campaign__c>();
List<Campaign__c> campList =[Select Id, Name, Accounts__c,Campaign_Project__c,Accounts__r.Name from Campaign__c where Id in: campUserIds AND Accounts__c in: accIds AND Type__c = 'Telemarketing' order by createdDate Desc limit 25000];
Set<id> campIds = new Set<id>();
for(Campaign__c camp: campList)
{
campIds.add(camp.id);
}
List<Member__c> membList = [Select Id, Status__c, Company__c, Contact__c, Contact__r.AccountId, Assigned_Date__c, Campaign__c from Member__c where Campaign__c in: campIds AND Status__c != 'Assigned' AND Status__c != 'Closed' ORDER BY Assigned_Date__c Desc limit 20000];
List<Task> openTasks = [Select Id from Task where OwnerId =: userRec.Id AND Campaign_Member_Id__c != null AND Status != 'Completed' limit 200];
Integer recCount = openTasks.size();
recCount = 200 - recCount;


Do you have the error number for the internal error?