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
ms0713ms0713 

How to get List Of All Standard Objects

I want list of all Standard objects.

 

please help.

 

reply asap.

 

thnaks.

Best Answer chosen by Admin (Salesforce Developers) 
soofsoof

Absolutely!  Use the describeGlobal() API call:

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_describeglobal_describeglobalresult.htm

 

The result will be an array of DescribeGlobalSObjectResult object (details of this object are also on the documentation page given above).  You can iterate over the array and look for objects where DescribeGlobalSObjectResult.custom == false.

 

Thanks.

All Answers

soofsoof
List<String> stdObjectNames = new List<String>();
for ( Schema.SObjectType typ : Schema.getGlobalDescribe().values() ) {
	String sobjName = String.valueOf(typ);
	if ( !sobjName.contains('__c') ) {
		stdObjectNames.add(sobjName);
	}
}
System.debug('stdObjectNames: ' + stdObjectNames);

 

ms0713ms0713

Thanks for your help.

 

Now, what if i want this thing in C#.

 

Is it possible to get this?

 

 

soofsoof

Absolutely!  Use the describeGlobal() API call:

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_describeglobal_describeglobalresult.htm

 

The result will be an array of DescribeGlobalSObjectResult object (details of this object are also on the documentation page given above).  You can iterate over the array and look for objects where DescribeGlobalSObjectResult.custom == false.

 

Thanks.

This was selected as the best answer
ms0713ms0713

Thanks a lot !!!

URVASHIURVASHI

hi

Could u please provide the code for "how to get list of all standard objects" in the form of visualforce page n apex controller.

Thank you.

 

Naveen KNNaveen KN
This may be useful

https://www.codengine.in/2019/05/How-to-get-list-of-objects-in-salesforce.html
Omkar Balasaheb MoreOmkar Balasaheb More

To get list of All Objects run below query from workbench:


SELECT QualifiedApiName FROM EntityDefinition ORDER BY QualifiedApiName LIMIT 200 OFFSET 200


Please know that there is a limit of max 200 records will be returned in list per retrieval. Hence add 'LIMIT 200' to restrict the result for first 200 records. Otherwise you will get below error
"EXCEEDED_ID_LIMIT: EntityDefinition does not support queryMore(), use LIMIT to restrict the results to a single batch"

If you need to get next results from record no 201 , 202, ... add 'OFFSET 200' to your query. this will show records from 201 to 400. Sililarly use 'OFFSET 400' for records from 401 to 600 and so on.