2

I have a custom setting object holiday__c and added one field into it i.e, date__c. I have entered all the values into it. Now my requirement is how to match the incoming date with the holiday dates field date__c. I've to call this field into apex and match with the incoming dates.

1 Answer 1

1

Custom settings methods are all instance methods, that is, they are called by and operate on a particular instance of a custom setting. There are two types of custom settings: hierarchy and list. From your description it seems like it is List type custom setting, in that case you can directly fetch value instead of looping all records described in Ratan's answer.

if(holiday__c.getvalues('NAME VALUE')!=null)
   system.debug(holiday__c.getvalues('NAME VALUE').date__c);
else
  system.debug('Not Found');

You can read more about custom settings in Apex

You must log in to answer this question.

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