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
Madhu007Madhu007 

Deployment issue with custom metadata type reocrds and test class.

i have created new custom metadata type. Used in the apex class. Later deploying the custom metada type object,records, apex class and corresponding test class through change set. i got the test class error due to custom metadata type. custom metadata records are not getting in the apex class due to this my test class failed. why custom metadata records are not recognizing in the deployment?
then what is the use of custom metadata types. To solve this issue i need to deploy custom metadata types first or try to populate the mock records in apex class.
Anant KamatAnant Kamat
Basically you need to include the Custom Metadata object in the changeset along with the Custom Metadata Type. Looks like you have included the Metadata Type and not the object in the changeset hence its failing.
Madhu007Madhu007
Thanks for the reply Anant. I have already added the Custom Metadata object. I misunderstood the issue. It's not because of Custom Metadata Type. There is a issue with Process builder due to that my test class was failing while deploying. I have fixed that and successfully deployed. I got to know, if we add the custom metadata object and reocrds properly we won't get any error in deployment. But for better stability of our production in future we should mock the custom metadata type reocords from test class to avoid the data issue in test classes run.