The question is simple: Is there any way to figure out from Apex code if custom settings is marked as protected or not? Looking through DescribeSObjectResult cannot find any single method related to that.

Any ideas would be appreciated, thanks in advance.

  • What do you want to accomplish by knowing if a custom setting is managed or not?
    – Raul
    Oct 11, 2017 at 11:55
  • @RahulSharma We have some rules which dictate if custom setting should be marked as protected (hidden from subscriber) or not. So based on this we would like to create a test method in our dev org to enforce those rules, i.e. basically control if we accidentally don't forget to make something protected, or cut off access to some settings by mistake.
    – wesaw
    Oct 11, 2017 at 12:02
  • Is your custom setting in a managed package?
    – Ankita
    Oct 11, 2017 at 12:34
  • @Ankita Yes, but we are talking about package dev org, i.e. it's the org where we basically are developing this package, so we have access to custom settings - just need to detect in apex code which of them are protected.
    – wesaw
    Oct 11, 2017 at 17:54

1 Answer 1


I think the only option here is to use Metadata API or some tools which use MetadataAPI under the hood like Andrew Fawcett package

You must log in to answer this question.

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