I want to create a generic component on which I will pass custom setting name as parameter and also list of fields which I want to get from custom setting.

So can we do this in Salesforce?

  • What did you try to do about this?
    – kurunve
    Jul 28, 2016 at 10:59

1 Answer 1


You can implement it yourself using String.

Something like this:

public List<SObject> getCustomSettingList(String customObjectName,Set<String> FieldList){
        return null;
    String soqlQuery = 'SELECT ';
    for(String field:FieldList){
    soqlQuery+' FROM '+customObjectName;
    return Database.query(soqlQuery);

You must log in to answer this question.

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