1 respuesta
Hi Sandy, In you batch class's start method you can get the start date and the end date of the current fiscal year using the below query -
Period currentFiscalYear = [SELECT StartDate, EndDate FROM Period WHERE Type = 'Year' AND StartDate <= TODAY AND EndDate >= TODAY LIMIT 1];
Once you have the currentFiscalYear, all you need to do is in your start method is
I hope this helps.Database.getQueryLocator([Select <FIELDS> FROM <ObjectName> Where CreatedDate >=: currentFiscalYear.StartDate and CreatedDate <=: currentFiscalDate.EndDate]);