i often come across scenarios where we have some custom setting with lots of fields created which has rows for multiple purposes. So for a specific scenario, it is often needed to filter all the rows in custom setting with some condition. I often tend to use SOQL as it appears to be more logical and easy. Do most of such custom settings qualify for being stored as custom object or is it possible to dynamically query custom settings by criteria on multiple fields using custom setting methods ?
1 Answer
If you are using custom setting methods, you will get list of all records for list custom settings. For hierarchy custom setting, there are methods to get most relevant entry for the user based on logged in user ID. But you will not get the flexibility you are getting in SOQL for filtering through custom setting methods.
But if you use SOQL for querying custom setting, it will count against query limit. Whereas custom setting methods will not count against it.