Activity Forums Salesforce® Discussions Is there any way to create the dynamic query on the custom setting. How? Reply To: Is there any way to create the dynamic query on the custom setting. How?

  • Ravi

    Member
    July 28, 2016 at 2:24 pm

    Yes you can create dynamic query on custom setting .

    `public List getCustomSettingList(String customSettingName,List FieldList){
    if(FieldList.size()==0)
    return null;
    String soqlQuery = 'SELECT ';
    for(String field:FieldList){
    soqlQuery+=field;
    }
    soqlQuery+' FROM '+customSettingName;
    return Database.query(soqlQuery);
    }`