I'm trying to move a change set from my sandbox to production and I'm getting this error:


I have been looking other post and other forums and I have done checks to make sure that I have all the privileges in production to run the test APEX coverage that is part of the change set. Like visibility on all objects, fields affected, edit, write, create, etc rights are also granted.

By reading this http://kb.omni-ts.com/entry/68/, it looks that this error is related to the rights I have on the objects, fields that I'm running the test. But, there is any other reason why this error my occur? I have all the rights and all fields are visible to me. I have double/triple checked this. The test code is on @isTest(SeeAllData = True) as well.

The Disable Parallel Apex Testing from Setup -> Build -> Develop -> Apex Test Execution is tick. I saw on a similar problem to this one, on a post, that if you receive this error ticking that box may solved this problem, din't work for me.

If I run the test class either on my developer or full data sandboxes I get no errors and the outcome of the test is 100% successfully tested.

If I transfer these APEX classes (APEX code and APEX test coverage code) by using change sets from developer to full data sandboxes I get no errors. There is any other place I may check to solve this? Any ideas?

I know that probably you guys are going to ask me to put the code here, but before that, and based on the fact that the cove works and it has being tested up to 100%, there is anything I can check before? Some tips or any other places that can be the reason of this error?



I found the problem. It is very important that you make sure that all validations rules, workflow rules, approval processes are check specially if you are using ids on them. In my case, I have a validation rule:

IF(AND(ISPICKVAL(PRIORVALUE(Status_Event__c), "Completed")), ($User.ProfileId != 'someIDhere'), false)

This validation rule was passed from the full data sandbox to production on the first change set. After this I was trying to transfer the APEX code and the problem started. Stared because the 'someIDhere' was an id of a custom admin profile! The standard System Admin id is equals in all environments but not custom ones. I changed the someIDhere to point to the correct profile ID in production, and that was the end of it.



  • Strictly speaking, your code should be written in a manner which allows it to run alongside validation rules. – Davin Casey Jun 17 '14 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.