I'm currently working to use the Salesforce REST API to get a list of all Salesforce Custom SObjects without including System or Standard Objects (like how the /services/data/vXX.X/sobjects/ does).

Is this possible or supported? I have found this answer which suggests using the following query:

SELECT SObjectType From ObjectPermissions Group By SObjectType

to get any object where you can assign a permission, but I do not know if that is a reasonable alternative to a simple Custom Objects call that I am seeking.

Ideally I would like both the name and label properties in the list, as I can query based on the object name for specifics later.

For Additional Context: The goal is to have a user select from a typeahead which object they would like to load. I originally was using the Describe route, however fetching the 2.3k objects (2.2MB payload) and filtering out non-custom objects take between 2 to 3 seconds, which is not effective.

Thank you in advance for any pointers.

  • why not create a rest service and call that instead? you can then fetch a filtered list in your apex and return it. – Ronnie Apr 2 '20 at 2:08
  • @Ronnie that sounds interesting, can you expand on that or point me toward documentation of making a REST service? Currently I'm getting the objects via the basic REST API to my server, filtering the list, and passing it to the web. Are you suggesting there is something in Salesforce I can do to return a prefiltered list from the SF REST API? Thank you. – Will Osbourne Apr 2 '20 at 13:50

No. The closest you can get is the Tooling API query "SELECT DeveloperName FROM CustomObject", which does (mostly) what you want, except that (a) you can't get the label, and (b) you need View All Data in order to use this API. In addition, your query would be limited to 2,000 custom objects, so this may not work in all orgs (I believe the limit in some orgs is 9,999 objects). In your case, I would prefetch the data, then filter client-side. You'll have a couple of seconds loading time, but only once per load (less if you use a @wire to cache the data).

  • Thank you for the information & suggestion. As it stands I do believe I am going to be looking into caching options to accomplish this. I appreciate the clarification and sanity check. – Will Osbourne Apr 2 '20 at 13:52
  • Marked as accepted because this was the closest to my final solution. In a sense, I do prefetch ans cache the data, however I do it serverside by running an indexer that stores the SObjects in Elastic Search, and query / filter from there, which gives good performance. Thank you for the help! – Will Osbourne Apr 8 '20 at 12:47

you can start here:



But be mindful that there are some limitations to what types you can return, so you may need to wrap things custom for what it is you may need. For some basic stuff that you want to work with like the API name and labels for filtering selection, this should do the trick.

In your rest service you can return a JSON of the options that you want with the values that you want and use that to build your options list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.