function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shubham Sinha 43Shubham Sinha 43 

How to query on Hierarchical custom setting records in apex

I have a hierarchical custom  setting called Audience__C and i have a checkbox field 'Booking__c'. now i have a requirement if booking__c is checked then update a field. So, how to query and put if condition on custom setting.We are using "Default Organization Level Value".

Please help on this.
don't query the custom setting. Use

audience__c a Audience__c.getInstance() ;

If this helps, please mark as Best Answer to help others too.
Shubham Sinha 43Shubham Sinha 43
thank you for your reply but how to put if condition ?

        Audience__C highVol = Audience__C.getOrgDefaults();
sorry, I don't understand your remark.