6

I am trying to delete a couple of old unused Apex Classes in our Production. Every time I try to delete all or one of them I get the following error message: "This apex class is referenced elsewhere in salesforce.com. Remove the usage and try again.: Apex Job - 7070900003iTBOz." (This Message occurs for every class that I want to delete and some classes get multiple of them)

The Problem is that the stated Apex Jobs in the error message are not findable and/or deleteable in the org. What I have tried so far:

  • Search with SOQL in the AsyncApexJob Object for the Jobs (with the 15-Character and 18-Character Version)
  • Execute System.abortJob() (with the 15-Character and 18-Character Version)
  • Execute System.purgeOldAsyncJobs (with the Date set to Date.today() and also Date.today().addDays(1)) and wait a few days for Apex Sharing Recalculation to execute
  • Delete the Class(es) with Ant Migration Tool
  • Delete the Class(es) with VS-Code and Salesforce Extensions
  • Delete the Class(es) with Workbench
  • Modify one the Classes, deploy it and retry to delete them (to trigger recompilation)

Articles that I read to resolve the issue: Cannot delete, no references but still says referenced elsewhere in salesforce.com

Why is this Apex Class dependent on a bunch of completed Apex Jobs? (The difference in my case to this question is that I can´t even query the jobs)

Does anyone have any more ideas or suggestions how I can delete the classes and get rid of the error message?

4
  • Hey could you check this thread out : salesforce.stackexchange.com/questions/1585/…
    – NedlaV
    Commented Jul 19, 2023 at 11:05
  • 1
    Thanks for the quick response! Unfortunately the article could not help me, but describes a very similar situation :) (The support is already contacted and stopping all scheduable jobs as well as activating deployments while Apex jobs are active could unfortunately not help either)
    – Florian
    Commented Jul 19, 2023 at 13:49
  • perhaps useful
    – cropredy
    Commented Jul 19, 2023 at 16:34
  • Definitely falls into the same range! Unfortunately, with both API version 58 and API version 31 I get the message "System.StringException: Job does not exist or is already aborted."
    – Florian
    Commented Jul 20, 2023 at 7:53

1 Answer 1

2

Contact Salesforce Support. They will be able hard delete those jobs for you.

2
  • 2
    Thanks! Already contacted them two days ago but it will probably take some time until I will be forwarded to someone who can do this
    – Florian
    Commented Jul 19, 2023 at 13:52
  • 4
    Update: I spoke to SF support this morning and they confirmed that there were some "bad references" that were only visible from their backend and could only be deleted by them. Now everything works fine again.
    – Florian
    Commented Jul 21, 2023 at 11:58

You must log in to answer this question.

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