Pages

Saturday, April 22, 2023

Salesforce: Query all Objects

As admin/developer, you can easily see all objects available in an org., but sometimes we need to get the list of the objects. Of course you can manually copy and paste from the Object Manager, but that is not ideal. 

Salesforce provide ability query using Tooling API from version 32.0 and later. EntityDefinition provides row-based access to metadata about standard and custom objects.

Sample query: 

SELECT QualifiedApiName, Label, ExternalSharingModel, InternalSharingModel, DurableId, DeploymentStatus, NamespacePrefix, Description, LastModifiedDate, LastModifiedById FROM EntityDefinition ORDER BY QualifiedApiName 


Compare from the Object Manager UI, using query, you also can also get the object sharing model, last modified by, DurableId. In this query, DurableId is the object Id, if you open a custom object from object manager, e.g. https://domain.lightning.force.com/lightning/setup/ObjectManager/01I50000000RAjx/Details/view, the one in bold is DurableId. While for standard object such as Account, the DurableId is Account, e.g.  https://domain.lightning.force.com/lightning/setup/ObjectManager/Account/Details/view

01I prefix is for CustomEntityDefinition


Reference:


No comments:

Post a Comment