New answers tagged

1

I can think of a couple of approaches 1 - Store the datetime in Custom Metadata. You can do this easily by exploiting this andyinthecloud GitHub repo . I have done this in one of my applications. You could also use a custom object. 2 - If possible, make the batch job idempotent so it can run with a filter like TODAY. If it encounters records it has already ...


3

Your problem is the aggregate query: AggregateResult[] miAccountList=[ SELECT Account_Item_Owner__c FROM Master_Inventory__c WHERE CreatedDate = LAST_N_MONTHS:2 GROUP BY Account_Item_Owner__c ]; Right now, you pull 2 months of data for all accounts in your system, even though you already know which Account records you care about. The most ...


Top 50 recent answers are included