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

unexpected token: ')' in batch apex
hi..need a help in query...oh batch class
Error is : unexpected token: ')'
We would like to move leads currently in the Working or Busy status that do not have completed tasks in the last 30 days to the ABC status.
We want to scheduale a batch class daily basis...here is the code..
Error is : unexpected token: ')'
We would like to move leads currently in the Working or Busy status that do not have completed tasks in the last 30 days to the ABC status.
- Lead Status = Working, Busy
- Last Activity Date < Today – 30
We want to scheduale a batch class daily basis...here is the code..
global class Leadinactiveflow implements Database.Batchable<SObject> { global Database.Querylocator start (Database.BatchableContext BC) { String query = 'SELECT Id, Status, LastActivityDate ,(select id, createdDate,status from Tasks )From Lead WHERE Status in (\'Working\', \'Busy\') AND (Today() - LastActivityDate) > 30'; System.debug(query); return Database.getQueryLocator(query); } global void execute (Database.BatchableContext BC, List <Lead> scope) { List<Lead> listLead = new List<Lead>(); for(Lead l : scope) { l.Status = 'ABC'; listLead.add(l); } if(!listLead.isEmpty()){ update listLead; } } global void finish (Database.BatchableContext BC) { } }Schedulable class is :
global with sharing class SchedulerForBatchApex implements Schedulable { global void execute(SchedulableContext sc) { Leadinactiveflow b = new Leadinactiveflow(); ID BatchID = Database.executeBatch(new Leadinactiveflow(), 200); } Public static void SchedulerMethod() { string con_exp='0 0 1 * * ?'; System.schedule('LeadinactiveflowTest', con_exp, new SchedulerForBatchApex()); } }
Please check below post Date Formats and Date Literals
1)https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm
Try below code
Let us know if this will help you
All Answers
Please check below post Date Formats and Date Literals
1)https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm
Try below code
Let us know if this will help you