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
Kayal PKayal P 

Query for entites list

Hi All,

 

Is it possible to query the available list of entities?

With the Salesforce service, i know its possible using the "describeGlobal" API call.

What is the query that will fetch the list of entities(i.e.) the available objects(both standard and custom objects). Any suggestion would be of great help!!

 

-Kayal

Naidu PothiniNaidu Pothini
List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();

List<String> ObjectList = new List<String>();

for(Schema.SObjectType obj : gd)
{
   ObjectList.add(obj.getDescribe().getLabel());
}

 Try this.

Kayal PKayal P

Thanks for your response. But im looking for a way to get the entities list by query? Through SOQL like how we fetch contact Id's using the query "Select Id from Contact", is it possible to get the entities list similarly??

 

-Kayal

Naidu PothiniNaidu Pothini

I am not really sure but i think there is no way to get the entities list through a query.

 

Kayal PKayal P

Oh thats really bad!! But thanks for your response Naidu!!

 

-Kayal