0

I have a batch apex that I made few changes. The functionality of the batch apex is to pull assets of a specific record type, and updates a specific field to true based on a criteria.

To test my changes, I entered the following code in execute anonymous window and clicked on execute button.

Date currentDate = System.today();
AssetBatch asb = new AssetBatch(currentDate);
database.execute(asb, 200);

when I run the above code from execute anonymous window, I see that only the start() method was executed and returned the assets of the SOQL. However, the execute() method did not run at all. I have a System.debug in the very first line of the execute() method and I am not seeing any references of the execute() method in debug log.

Can someone tell me what am I doing incorrectly?

Thanks in advance.

1
  • 1
    Start, each execute, and finish will each appear as separate logs. Did you check all your logs?
    – sfdcfox
    Feb 2, 2023 at 10:30

1 Answer 1

0

The main reason why execute() won't execute is your start() method is returning zero records to process the execution.

The secondary reason could be throttling is happening in the org. This happens when your org is running too many batch job and to prevent impact Salesforce throttles the executions.

For additional troubleshooting, would suggest to add the batch code so that I/Others can answer better.

1
  • Thanks for your response. As I mentioned in my OP, the SOQL in start() method is returning assets (25) and I could see them in the debug log. Again, throttling is also not an option since this is my individual sandbox and I am the only one using this sandbox. Regarding the code, I will post tomorrow. Feb 2, 2023 at 6:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .