0

BACKGROUND

I am writing a unit test which tests changing an object's record type.

I want the unit test to be Org agnostic, therefore not rely on any custom objects or custom record types.

As it's not possible to dynamically create Record Types when setting up data for the unit test, I need a standard object which has multiple record types by default.

QUESTION

Are there any standard Salesforce sObjects which have multiple record types by default?

  • 1
    not to my knowledge – glls Jul 21 '18 at 15:58
1

No, there are not. Record Types only exist in certain editions anyways, which I believe means from a technical perspective, if you're not careful, you'll end up restricting your code to only higher-level editions. If you need to, you can the stub api (one implementation you can refer to is ApexMocks). If you design it carefully, you can make a system that would work regardless if real record types exist. I don't have an implementation of this handily available, though.

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.