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
Andrew Chinn 8Andrew Chinn 8 

Orphaned AsyncApexJob stuck in Queued Status

The problem here is that I have an AsyncApexJob that is stuck in Queued status.  It was initiated from a CronTrigger so I can not use System.abortJob on the AsyncApexJob Id, when I do it gives me an error that I need to use the CronTrigger.  I have reviewed the scheduled batch jobs and the scheduled job is not listed there.  This is currently blocking our ability to implement a fix to our batch job.  Is there a way to remove the AsyncApexJob from the database so we can deploy our changes, or is this something we will need to contact SF Support about.
ShashankShashank (Salesforce Developers) 
Please see if this helps:
Andrew Chinn 8Andrew Chinn 8
Hello +Shashank.

We have tried using System.abortJob and it does not work.  We are told to use a CronTriggerId.  The problem is no CronTrigger record exists for us to abort it with.

This is an issue that was reported here:

It seems the resolution to this was to have Salesforce Support help by clearing it out from the backend.  I have contacted support but my Org does not have Premier Support so they will not help us remove the job.  This is currently blocking our deployments and causing us to have to run a lot of new processes manually using Anonymous Apex.

We have contacted our sales rep to see if she can push this issue.  But if any of Support Developers reading this.  We need help, we are unable to cancel a job that the system has orphaned.  This is a platform issue and should receive supported regardless if whether or not an org has Premier Support or not.

Thanks for the search Shashank I appreciate your time.
ShashankShashank (Salesforce Developers) 
Don't worry, I will help you out. Please send me your org Id and exact replication steps to by referencing this post and I will take it up from there.
Salesforce JediSalesforce Jedi

Hi Shashank,

I am having the same problem, I actually had this solved by Nilima (level 2 support) early last year (I can cite the case # if needed). Now we are getting this problem again and are unable to save our bug fix code to the sandbox, let alone deploy it to our live environment. 

Is it possible for you to have a look into deleting the ghost jobs from our test server so we can continue with our bug fix please?

I tried to go through a support ticket but apparently after having access to this feature last year, we are now unable to submit a support ticket. I agree with Andrew Chinn 8 that this is a platform problem and should receive support regardless.

Thanks for your time.