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
SFManiSFMani 

Unable to deploy the code into production

Everytime I try to deploy any code from sandbox to production if gives the error failed with two test classes failing within the organisation, the test classes are tom_test_status_changes and tom_test_status_changes. Even on running these classes itself in the production the test fails.

The error message it gives is System.DmlException: Update failed. First exception on row 0 with id a0WG000000LAcROMA1; first error: TRANSFER_REQUIRES_READ, The new owner must have read permission: [] for both the test classes. I tried the solutions given on other threads with similar problem to check for owner permissions and also removing the with sharing keyword in the apex class. Still the problem persists.

I would really appreciate if anyone of you geeks can help me solve the problem. It is really urgent as I need to immediately deploy the new updates to the organisation. 
Best Answer chosen by SFMani
SFManiSFMani
Today I found out that there was a package Time_off_Manager installed in the organization. The classes failing belonged to this package and this package is no longer in use. So I deleted the package and the problem was solved.
Thanks everyone for your valuable time and effort for helping me solve the problem.

All Answers

Naval Sharma4Naval Sharma4
Hi SFMani,

I can't tell you what's wrong with your test class without taking a look at your code. You can refer this link and it would help you.

https://developer.salesforce.com/forums/?id=906F0000000BXwAIAW
Naval Sharma4Naval Sharma4
Hi SFMani,

I can't tell you what's wrong with your test class without taking a look at your code. You can refer this link and it would help you.

https://developer.salesforce.com/forums/?id=906F0000000BXwAIAW
Mahesh DMahesh D
Hi SFMani,

If you can paste the Test Class code then will try to guide you.

Make sure that which ever user you are trying for with, it is assigned Role then it will be accessible to all records. Then you will not get any sharing issues.

There may be owner change is happening whenever you change the Status.

Regards,
Mahesh
SFManiSFMani
Today I found out that there was a package Time_off_Manager installed in the organization. The classes failing belonged to this package and this package is no longer in use. So I deleted the package and the problem was solved.
Thanks everyone for your valuable time and effort for helping me solve the problem.
This was selected as the best answer