function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
j_panchalj_panchal 

Access SalesForce APIs in custom controller.

Hello,

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.

 

Thanks

Abhi_TripathiAbhi_Tripathi
Hey,

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.

Regards,
Abhi Tripathi
Salesforce Developer