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?
9
-
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 Jun 12 '14 at 15:56
-
only one row. I'm not planning on having many rows. – user9862 Jun 12 '14 at 16:03
11
here you go :
MyCustomSetting__c cs = MyCustomSetting__c.getInstance('Days');
// you then have access to cs.active__c and cs.age__c