10

I created a custom setting with two fields Active__c and Age__c. In my apex code, I want to retrieve one record from this custom setting where Name='Days'. This will return only one record. Would I need to use List to get this result or can I simply get this into a variable?

2
  • How many rows are there in your settings table? Are you interested in having many Age__c and Active__c rows for different "scenarios"?
    – greenstork
    Commented Jun 12, 2014 at 15:56
  • only one row. I'm not planning on having many rows.
    – user9862
    Commented Jun 12, 2014 at 16:03

1 Answer 1

13

here you go :

MyCustomSetting__c cs = MyCustomSetting__c.getInstance('Days');
// you then have access to cs.active__c and cs.age__c
0

You must log in to answer this question.

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