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

How Can we do a SOQL Query on a List Custom Setting?

select field names from customsettings API name.
ex:select id,name from customsettings__c
Amit Chaudhary 8Amit Chaudhary 8
you can simply query the custom setting record like any other custom object
select name from customSettingName__c

farukh sk hdfarukh sk hd
To use custom settings in class,
You can use the methods available.

Methods available with list custom settings are:


Methods available with Hierarchy custom settings are:

For more details visit,

Suraj Tripathi 47Suraj Tripathi 47

Yes, you can perform SOQL query in custom settings as you perform in the salesforce object.
For example-
You have a custom setting name School__c which having the field RollNo__c and Name.
Your query should be-
SELECT Name, RollNo__c FROM School__c WHERE Name = 'XYZ';

If you find your Solution then mark this as the best answer. 

Thank you!

Suraj Tripathi