Search code examples
salesforceapex-codevisualforce

How to retrieve an array list


I want to retrieve an array list using visualforce page, for example, evry user is identified by his name, email, adress and a table of folders, evry folder has an ID, and name.

How can I do this, please ?

Thanks in advance.


Solution

  • Retrieving objects in SFDC is done with SOQL. You can read more about it here.

    For example, to retrieve a the name and id of every user in the org:

    User[] users = [select Id, Name, from User];
    

    If you want to show the information in a Visualforce page, you should make the users variable a property. Then you can use apex:dataTable or apex:repeat to show the values.