1

is there any way to convert list of string to custom settings. i know we can convert list of strings to sobject. please advice me

String objName = 'Account';
String query = 'Select Id From '+objName+ ' Limit 10';
List<SObject> objL = Database.query(query);
system.debug('datea====='+objL);

like above snippet is it possible to convert strings to custom setting as sobjecttype

  • Where is your list of string? What do you want the end result to be? For reference, I would like to know, how can you make a list of string into SObject? Please edit your question to the point. – Santanu Halder Apr 8 '17 at 6:32
  • 1
    Why? what are you trying to accomplish by converting a set to a custom setting? What advantage would doing that offer? – Eric Apr 8 '17 at 6:32
0

I'm not able to understand what you want to ask. My guess is you want to execute below code for custom setting as well-

String objName = 'Account';
String query = 'Select Id From '+objName+ ' Limit 10';
List objL = Database.query(query);
system.debug('datea====='+objL);

If yes, yeah you can pass the custom setting API Name in objName variable.

String objName = 'CustomSettingAPIName__c';
String query = 'Select Id From '+objName+ ' Limit 10';
List objL = Database.query(query);
system.debug('datea====='+objL);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.