1

If I have a custom list setting, 'Info_List__c' with 2 fields, 'Info_Field__c' and 'Info_Name__C'.

What would a method look like that would iterate through the list and return all entries.

And how would I call that method from a VF page and store the results in a JS object?

The returned Object would look as follows if I was to print it into my console:

0:Object
    Info_Field__c : "Value"
    Info_Name__C : "Value"
1:Object
    Info_Field__c : "Value"
    Info_Name__C : "Value"
2:Object
    Info_Field__c : "Value"
    Info_Name__C : "Value"
3:Object
    Info_Field__c : "Value"
    Info_Name__C : "Value"
3

For easy reference in your JavaScript, I recommend a simple method to return a map of string to object from a remoting method. It would look something like this:

@RemoteAction
global static map<string,object> getSettings() {
  return MyListSetting__c.getAll();
}

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.