function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Max Michael Ingraham-RakatanskyMax Michael Ingraham-Rakatansky 

Scheduled Apex Class status becomes "Aborted" after "Completed"

Hello,

Admin here so apologies for any inaccurate terminology on my part.

We have an Apex class with a @future tag that has been responsible for creating a scheduled apex class to change the ownership on a newly created record. This process for the most part has worked without a hitch, though recently we had a couple of snags we can't explain.

The first thing that happens is that while the Scheduled Apex class will be listed as "Completed" in the Apex Jobs Queue, that status will then change to "Aborted" the next time that apex class is called for a new record (which will itself be listed as "Completed" until the next job is called). This doesn't appear to affect functionality at all, but it somewhat strange.

The second thing that happens is that, out of the blue, an Apex job a few days ago got stuck at "Queued" for no particular reason and never fired(causing the ownership of the record to stay the same). By all accounts this hasn't happened before, and we have no idea what could have caused it since there wasn't really anything unusual with the record or the system going on at the time (we tried it again with an identical record and it worked perfectly). 

Any idea why this could be happening? We haven't encountered problems like this before and our development company is stumped. I'd be happy to provide Apex Code/Debug Logs if necessary.

Thank you,
Max
Best Answer chosen by Max Michael Ingraham-Rakatansky
Marcelo CostaMarcelo Costa
By the description, looks like there is some code in your Batchable class that aborts the execution in some condition...
Would be helpful if you posted it, otherwise would not be easy to troubleshoot :)
Good Luck!