0
votes

I am trying list all the API Names available in a salesforce organization. I am able to retrieve all the object API names using below code:

for ( Schema.SObjectType o : Schema.getGlobalDescribe().values() )
{
    Schema.DescribeSObjectResult objResult = o.getDescribe();
    system.debug( 'Sobject: ' + objResult );
    system.debug( 'Sobject API Name: ' + objResult.getName() );
    system.debug( 'Sobject Label Name: ' + objResult.getLabel() );   
}

But the list does not contain the objects belongs to managed packages and unmanaged packages.

And also I am trying to access managed package objects records via workbench.developerforce.com , I am getting the error as

message: Select COUNT(id) FROM CustomObject__c ^ ERROR at Row:1:Column:23 sObject type 'CustomObject__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. errorCode: INVALID_TYPE

I did post question developer.salesforce.com did not get the response yet.

EDIT :

Setup#QuickSearch#Objects this screen has the objects listed from managed packages but same objects not coming in Schema.getGlobalDescribe().values().

2

2 Answers

0
votes

A managed object should contain two underscores before and after the object name:

Namespace__CustomObject__c

You should be able to identify it by the Namespace or by the fact that still it contains two consecutive underscores after removing __c

0
votes

In case someone is still looking for SOQL, This can be achieved using following SOQL as well

select sobjecttype from ObjectPermissions where parent.NamespacePrefix='PackageName'