+ Start a Discussion

Access SalesForce APIs in custom controller.


Being a newbie to salesforce development this may seem a very basic question.


I made a custom Controller and want to get list of companies or organization that are listed/present in salesforce and display them on visualforce page.

So, is there any API OR sObject (like Account, Contact) in Salesforce to get the company list..


Below is the controller code which I am using currently



public string orgName;


public String getName() {
List<Organization> org = new List<Organization>();
org = [SELECT Id, Name FROM Organization];

for(Integer i=0; i<org.size();i++)
orgName += org[i].Name +',';
return orgName;


but it returns only 'GMail' as output.


I am also not able to find any APIs or API list of salesforce which we can access in apex controllers to get the data.
Please help me out.




This object "organization" represents key configuration information for an organization. You must have the “View All Data” permission to access this object.

And to access the data use visualforce pages, there you can easily fetch and filter your data using queries.
and for the objects API's and other information about fields of the Object, use Eclipse Schema.

Abhi Tripathi
Salesforce Developer