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
gsickalgsickal 

Custom Objects and Inheritance

I am developing an app for the salesforce platform and have a general question about the architecture of custom objects.  I want to be able to create different "types" of custom objects which are really more like a "subclass" of one of the standard objects.  These custom subtype objects would have (inherit) all the field and methods of the base class, but would also contain their own unique fields, methods, customer links, etc.  I want to do this *without* having to add a custom "type" field to the base object and making this type field a picklist of all the available subtypes for the object.  Creating the new subclass object with a Master/Detail relationship isn't really a truly accurate design since that relationship implies a one:many relationship between the objects and what I want is a 1:1.  In other words, it's not a header object with (possible) multiple detail records relationship, not is it really a lookup type either.
 
For example, in addition to the "base" Account object, I might want to have "Personal Account" and "Business Account" and "Charity Account" objects all with fields inherited from the Account object, but with their own unique fields as well.  Can this be done?  If so, what is the best way to do this?  If not, would I be better off using a Master/Detail, Lookup, or no relationship at all?  thanks
DevAngelDevAngel
Take a look at record types. This gives you I think most of what you need. When you create mutliple record types for an object, you can create layouts for the record types and modify picklist values for the different record types. This allows you to add custom fields to an object that only apply to your "inheritor" as to visibility on layouts.
Burton024Burton024

This worked pretty well DevAngel. Thanks!

Burton024Burton024
Is there another way this could be accomplished? My problem is that I have too many fields in the subtypes to use record types.