Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

What is the difference between Custom Setting Type "List" and "Hierachy"?

share|improve this question
add comment

1 Answer

up vote 10 down vote accepted

What's your use case? One will fit better than the other.

Hierarchy custom settings can be configured at varying user specificity levels under a single name; the platform will look for the most specific configuration first, then fall back / inherit to the least specific:

  • setting per user,
  • setting per profile,
  • setting for whole org,

Hierarchy custom settings are easily retrieved in Visualforce: {!$Setup.Setting__c.Field__c} and will be resolved according to the current user context.

hierarchy custom setting

List custom settings have user-independent values, retrieved under multiple names. For example, you could use several configs to hold the credentials for a web service callout so that you can swap the endpoints:

  • setting for development environment,
  • setting for volume testing environment,
  • setting for production environment,

List custom settings need to be accessed using a controller if you want to avail them on a page, for example return ListSetting__c.getInstance('dev').Field__c;

list custom setting

share|improve this answer
    
I might adjust the wording of the last statement, as you typically wouldn't want to "query" a custom setting in Apex, you use an accessor method to retrieve the cached setting values. But good answer otherwise. –  Peter Feb 25 '13 at 9:51
1  
At the moment I don't have complicated use cases, I have been working with List most of the time, I didn't have a clue what Hierarchy was, and wanted a clear explanation that showed the differences between List and Hierachy, thanks, i'll be checking that out! –  PJC Feb 25 '13 at 10:22
1  
Great answer. I would suggest amending from "Sometimes one or the other is a more appropriate fit..." to "One or the other is always a more appropriate fit..." since they are so different in their usage. Lists are great for global registry-like settings, and hierarchy are great for settings that may need different values for different groups or individual users. I've never seen a requirement that could "correctly" be satisfied by either - one is always more appropriate than other, but both are very useful. –  jkraybill Feb 25 '13 at 11:36
1  
thanks WesNolte and @jkraybill - I've differentiated 'org-wide under multiple names' vs 'user-specific under a singular name' –  user320 Feb 25 '13 at 12:03
2  
Very nice answer buddy! Screenshots with drop-shadows - what the... ;-) I would perhaps suggest providing a different example use case for list settings - I think the docs use tax codes - to distinguish the types even more clearly –  Stephen Willcock Feb 26 '13 at 20:51
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.