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
Jordan VasquezJordan Vasquez 

Can only deploy custom code if debugging enabled for my user?

Hello everyone,

I have a very interesting problem that has been giving me a migraine for the past few days.

I am currently trying to fix something in our Production environment that involves Mixed DML modifications. Basically the gist of the class is if an Account is set to Inactive, then all Contacts and Customer Community Users should also be set to Inactive.

I am using @future methods to accomplish this. I have ran my test classes and QA testing in my sandbox and everything looks fine. I go to deploy to Production and I get multiple assertion errors when checking if the User record has been deactivated. Checked the code in my sandbox and everything is fine. I tried doing this a few times and the errors occurred each and every time. So I then proceed to turn on Debugging for my user and lo and behold, it now works perfectly when deploying to Production. Why is that?