You need to sign in to do that
Don't have an account?

Salesforce Production Deployment Test Class Error out.Unable to access record type
As we all know for production deployment , Test classes will be automatically running , right !!! . We have issue with that . Half of our test classes are failing because of access issues .
Items to note :
Actual Issue : As our production doesnt have any recordtype test class is failing saying it unable to find the record type .
Now million dollar question : How we can over come this issue . it is really blocking our production deployment
Items to note :
- 1)in Our test classes it is not using any database data .ie SeeAllData =false
- 2)First deployment to Production . No recordtypes available
- 3) we are pushing admin profile in the package which have access to all the records types present .
Actual Issue : As our production doesnt have any recordtype test class is failing saying it unable to find the record type .
Now million dollar question : How we can over come this issue . it is really blocking our production deployment
we able to solve this issue, as it is new environemnt , system admin doesnt have any recordtype access . once we provided the recordtype access to systemadmin we able to complete the deployment on time .
Note: we deploy all the components in single deployment ( Metedata and code ) around 8500 components .
All Answers
Step 1) Deploy all metadata first (Object ,field and record Type)
Step 2) Then deploy code.
Without actual error and based on the information you provided, some of my thoughts below:
Check for the following:
- If the record type for the Contact sObject is in existence. Sometimes, it get deleted.
- In the affect test class, check for Running Context User and assigned Profile. Including a Profile as a part of change set doesn't have anything to do with running of the Test Class.
- Finally, if you are stuck and running against the time, hard cord the record type id (disclaimer - not a best practice). And sure that the context user/profile has access to record type in subject.
Hope it helps
Mubeen Qawi
@Mubeen --Our producton is empty , no record type is available
@sven -- it is included in the package , plus admin profile which is part of package having access to those records .but still it is throwing error
@Amit -- Yes, Splitting is only option .but our objects have button and Vf pages which leads to Classes. Menaing , it leads to lots of confusion
When deploying the system will validate against the metadata, If it s new environment, make two packages one for the metadata and other packages for features like apex classes, triggers etc.
This is the only available option to deploy to your code.
Thanks
Pramodh
we able to solve this issue, as it is new environemnt , system admin doesnt have any recordtype access . once we provided the recordtype access to systemadmin we able to complete the deployment on time .
Note: we deploy all the components in single deployment ( Metedata and code ) around 8500 components .