Is exist Interface or Base class for Custom setting? I tried use SObject class, but it does not support Custom Settings Methods.

For any SObject we can use SObject class, that base class for standard and custom object.

SObject account = new Account();

We can use SObject for Custom Settings, but there are no specific Custom Setting methods

SObject settings = new MyCustomSettings__c();

What class contains specific Custom Settings methods?

  • 1
    Please explain your question in more detail. Aug 1, 2015 at 9:59

2 Answers 2


There is no base type that includes the extra methods that custom settings support. This unfortunately means that if you want to write some code that applies to many of the custom settings, you will have to write it over again for each one. Or perhaps you could use the adapter pattern with a small adapter class per custom setting to create your own consistent interface.

  • Thanks, I also couldn't find base class in documentation.
    – Gres
    Aug 2, 2015 at 8:49
  • I can confirm that there's no such type, documented or otherwise. It's a cool idea; you might want to post it on the IdeaExchange. Sep 26, 2015 at 4:24
  • @AvromRoy-Faderman In my experience development oriented ideas get few votes and are rarely implemented by Salesforce.
    – Keith C
    Sep 26, 2015 at 8:35
  • Actually it occurs to me that that might not make sense anyway. The special custom settings methods are all static, so couldn't be exposed on an interface. And it wouldn't make sense to put the method on a base class, because what would it return? You can't have abstract static methods. Sep 27, 2015 at 18:09

Custom Settings are part of the System Class and have their own methods. Using a DescribeSObjectResult, they can be detected in the results when isCustomSetting() == true.

  • Yes, it is clear. But I want know exist either base class with specific custom settings methods, like getAll(). That I can use this class instead of specific custom setting type, e.g. SObject we can use instead of any other object type.
    – Gres
    Aug 1, 2015 at 16:34
  • Click on "Custom Settings" in my answer above. That will take you to the methods available for use with custom settings. sObject methods are not available for use with Custom Settings, only those through the link I've provided.
    – crmprogdev
    Aug 1, 2015 at 16:39
  • "Custom Settings" is SObject with specific methods. I would like to know any Interface or Base Class for this methods.
    – Gres
    Aug 1, 2015 at 16:48
  • 1
    Try to run following code in your Org: ApplicationSettings__c appSetting = new ApplicationSettings__c(); System.debug((Object)appSetting instanceOf SObject); ApplicationSettings__c - My Custom Settings
    – Gres
    Aug 1, 2015 at 16:57
  • 1
    Yes, custom settings classes are indeed subclasses of SObject. There is no common interface or base class that exposes their special methods. Sep 26, 2015 at 4:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .