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
Juan SpagnoliJuan Spagnoli 

Issue with Apex Class Coverage

I tried without success to fix this SF's issue. I edited a class that was not longer used (couldn't delete it) to reduce useless code, but SF is showing me the same lines count than before. I know that Salesforce save metadata of apex classes in an object, but we cannot access to that table. I attached a screen showing the issue, I don't know what can I do to fix it. I fear that is affecting my org's apex coverage level:


User-added image

Thanks for the help.

PD: I already tried to delete the class using the IDE, but It gave me an error related to AsyncApexJobs, like there was a job using that class, but really there was not.
Best Answer chosen by Juan Spagnoli
Sampath KumarSampath Kumar
Hi Juan,

We need to raise a case to salesforce support team so that they will run the script to delete these kind of jobs or apex sharing calculation.

Please let me know if you have any more queries.

Regards
Sampath Kumar Goud

All Answers

Sampath KumarSampath Kumar
Hi Juan,

You are not able to delete the class as it is being used by some job which got stuck in the backend. Please go through the folloqing article and run the code mentioned in it and then delete the class.

https://help.salesforce.com/HTViewSolution?id=000004423&language=en_US

The impact of running the code in the article is you need to reschedule the jobs but it will delete all the jobs which are stuck in the backend.

Please mark this as best answer if it work to make this community clean and re-usable..Try and let me know if it work for you..

Regards
Sampath Kumar Goud
Juan SpagnoliJuan Spagnoli

Sampath, thank for your response. I queried the CronTrigger table and the result are jobs that are correct.

This is the error that I'm getting when I try to delete the class:

Problem: This apex class is referenced elsewhere in salesforce.com.  Remove the usage and try again. : Apex Job - 70750000000dbAu. This apex class is referenced elsewhere in salesforce.com.  Remove the usage and try again. : Apex Job - 70750000000dbAz. This Batchable class is in use. : Apex Sharing Recalculation.

I queried AsyncApexJob's table using the job id and, of course, it doesn't exists anymore. So I guess that the issue is related to that Apex Sharing Recalculation. The class is really old and the job was deleted months ago. How can I release the class from that sharing recalculation?

Thanks again 

 

Sampath KumarSampath Kumar
Hi Juan,

We need to raise a case to salesforce support team so that they will run the script to delete these kind of jobs or apex sharing calculation.

Please let me know if you have any more queries.

Regards
Sampath Kumar Goud
This was selected as the best answer
Juan SpagnoliJuan Spagnoli
Sampath, they ran the script and fixed the issue, and then I deleted the class.

Thanks a lot.