When trying to deploying from Sandbox to Production, one our test fails because a Record Owner is set to be a user whose license has been disabled in production.

Given that the code is not setting the record owner in the tests, how is the Record Owner determined?

  • What type of object is it? There are many flavors of assignment rules...
    – Adrian Larson
    Jun 11, 2017 at 17:08
  • record owner is who created the record for case and lead we have assignment rules need to know the object to understand the answer. default lead owner can't be disabled so not sure what object you are refering Jun 11, 2017 at 18:11
  • Most likely, this would indicate an issue with your RunAs User configuration if you're using one. That user is apparently being queried or created as the user with the profile that's been disabled.
    – crmprogdev
    Jun 11, 2017 at 20:38
  • It is a custom object. Where do I check the RunAs setting? Jun 12, 2017 at 10:48

1 Answer 1


You should 100% definitely fix your code to not fail before deploying to production. Failing to do so may prevent you from being able to deploy code in the future under an urgent circumstance. However, if this is the urgent circumstance, there is setting that you can use to enable System Administrators to set an inactive User as the owner of a record.
Set Audit Fields and Update Records with Inactive Users

  • I am looking to understand why the owner is set to an inactive user Jun 12, 2017 at 10:48

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.