0

Recently I run into a need to list all custom object and standard object in my org in an UI Component to allow user to search and select. I have tried several ways of implementation, but none of them are good enough when it comes to orgs that have large object sets(over 1000).

Attempt 1: use method mentioned in this thread: How to get Standard and Custom Object List in Apex class

Calling schema.getGlobalDescribe() in Apex and than looping the describe result and filter out system event by checking sensitive words or format like "changeEvent", "Feed", "Share".

This attempt have two main problem:

  1. the text matching is not accurate and extendable, because these sensitive word are not really reserved words in salesforce, the org may contains custom object with these words in
  2. schema.getGlobalDescribe() takes a performance hit when the org contains large set of objects. I am including the system objects like feed, share or changeEvents

Attempt 2: Calling https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_describeGlobal.htm describeGlobal rest api to get the result and each result have a field called "triggerable" and use that as a filter criteria. This attempt:

  1. do a better filter on system object but still not filtering out all system object
  2. the rest api throws error when an org contains object definations larger than 1000. it has scalability issue.

How do I filter out system objects while making the describe objects call with more than 1000 sobject types in an org? or if there is a query can be done object metadata to filter in/out system objects.

Does Apex or Object Describe API provide native way of querying sobject excluding system objects? OR if there is any method can help to provide a paginated way of retrieving sobject describe result?

Thank you!

2
  • Recently I run into a need to list all custom object and standard object in my org in an UI Component to allow user to search and select - sounds like you're reinventing Object Manager, it has a search feature. Please edit your question and describe what you're trying to accomplish - see XY Problem
    – identigral
    Commented Jul 23 at 2:35
  • updated the question @identigral Commented Jul 23 at 2:48

0

You must log in to answer this question.

Browse other questions tagged .