You need to sign in to do that
Don't have an account?
Muhammad Jawwad 16
Query is not working in Start method tell me where am i wrong?
global class MonPipelineReportBatch implements Database.Batchable<sObject> { public String query = 'SELECT Loan_Officer_1a__c,Loan_Officer_1a__r.Email, Name, Phone, Starting_Credit_Score__c, ' + 'Status, Enrolled_On__c, Est_Re_Pull_Date__c, Realtor_Name__c ' + ' FROM Lead'; public EmailTemplate templateId = [Select Id,HtmlValue,Subject from EmailTemplate where name = 'LoanOfficerRecord' LIMIT 1]; global Database.QueryLocator start(Database.BatchableContext bc) { Date startDate = Date.today().addMonths(-1); startDate = Date.newInstance(startDate.year(),startDate.month(),1); Date endDate = startDate; Integer days = Date.daysInMonth(endDate.year(), endDate.month()); endDate = Date.newInstance(startDate.year(),startDate.month(),days); query += ' WHERE CreatedDate >=: ' + startDate + ' AND CreatedDate <=: ' + endDate + ' AND Loan_Officer_1a__c != null'; return Database.getQueryLocator(query); }
All Answers
Like below
Fatal error
Like the answer, if it worked.
SELECT Loan_Officer_1a__c,Loan_Officer_1a__r.Email, Name, Phone, Starting_Credit_Score__c, Status, Enrolled_On__c, Est_Re_Pull_Date__c, Realtor_Name__c FROM Lead WHERE Loan_Officer_1a__c != null
and then try this
SELECT Loan_Officer_1a__c,Loan_Officer_1a__r.Email, Name, Phone, Starting_Credit_Score__c, Status, Enrolled_On__c, Est_Re_Pull_Date__c, Realtor_Name__c FROM Lead
To me, it looks like Loan_Officer_1a__c is NULL in all leads