Salesforce Custom Metadata

When to use Custom Metadata vs Custom Object

This question seems pretty easy and a decision could be straightforward in choosing Custom metadata vs Custom Object. However, I wish it could have been that easy, it’s not as simple as choosing between black & white color.

Many of my clients, struggling because of over usage of Custom metadata. Eventually, when there really is a need to choose custom metadata, they are already exhausted or near to reaching 10 Million character limits in Custom Metadata.

As I advise them on what are my thumb rules, thought to put a quick & very simple blog post. I would welcome all of your feedback & comment in this blog post to see if I can improve recommendations.

1. Controlling Application Behavior

If you want your customizations or configurations to behave differently depending on this data, then choose – Custom Metadata. Examples could be an On-Off switch for the trigger, assigning a queue on basis of the configured region, etc.

2. Need to use in Validation rule, Formula

If there is a need to use data in the Validation rule, formulas, flows, etc then choose Custom Metadata.

3. Data Maintained by System Admin or Business Users

If data needs to be maintained by business users who would not have access to Setup & Configurations then use Custom Object. If data needs to be updated & managed by the System admins only, we can still use custom objects & control visibility using profiles or permission sets. This is really not a strong case for using custom metadata.

4. Reporting or Refer to existing custom or standard object

Custom metadata does support parent-child relationships but to other custom metadata only. Therefore, if we need to refer to any existing standard or custom object, then we have to choose a custom object.

Another important aspect is reporting capability needs. If we want standard Salesforce reports to work, we would need Custom Object.

5. Moving data between orgs

Custom metadata can be deployed using tools like changeset, and SFDX. However, I still don’t see it as a enough strong reason to use the custom metadata. We can always have a command line data loader to load records or an Apex class to read static resources and load data if needed.

6. Governor Limit on the volume of records – Important

In my opinion, this is the most important area that needs due diligence. Custom Objects records only take 2kb of space, no matter how much content there is. However, custom metadata size is decided on basis of field size & not actual records. So, if you have a text field of size 255 characters and storing only 10 characters, Salesforce would still count it as 255 characters.

The Governor limit is 10 million characters for custom metadata, and you might think it’s more than enough. Let me give you an example breakdown :

Let’s assume, you have 5 custom metadata defined in your org. Assume, each custom metadata has 20 fields of type text with 255 characters size. If each custom metadata has even 500 records, you would hit the 10 Million characters limit.

The thumb rule that I follow is – If there is a need for around 30 fields and the total number of records could exceed 100, I reevaluate my solution very carefully to make sure the application is scalable in the future.

7. Encryption need

Custom metadata does not support encryption. If you are in the healthcare industry and security, compliance is paramount, you might need to go with Custom Objects.

Above are 7 areas I evaluate and depending on the overall score, it makes things clear on what to choose between custom metadata & custom objects.

I have intentionally not mentioned other advantages of Custom Metadata like SOQL limit, performance because of caching, etc because they might not have a huge impact on decisions.

However, feel free to add some other dimensions that could help or impact your decisions.




Related Posts


11 responses to “When to use Custom Metadata vs Custom Object”

  1. Youngblood Avatar

    Excellent writing on this topic! Thank you.

  2. Arijit Nag Chowdhury Avatar
    Arijit Nag Chowdhury

    WoW. Very nice explanation !! To the point and crisp.
    One Question : ‘Custom Objects records only take 2kb of space’ —
    Custom Object ‘A’ – Has 10 fields and 1 Record and every field contains 10 characters.
    Custom Object ‘B’ – Has 10 fields and 1 Record and every field contains 100 characters.
    Custom Object ‘C’ – Has 100 fields and 1 Record and every field contains 5 characters.

    All these Custom objects have 2kb ?

    1. Jitendra Avatar

      Correct. The exception is Person Account – 4kb, Campaigns – 8kb, and Articles – 4kb. More details can be found in the help & training documentation –

    2. swapnil Ingawale Avatar
      swapnil Ingawale

      Very good explanation 👍

  3. Arijit Avatar

    Very Nice Explanation

  4. Mitul Patel Avatar
    Mitul Patel

    To the point explanation. This is a basic decision projects face so often. Thanks for sharing.

  5. Gaurav Avatar

    why your decision is not impacting based of other advantages of using MDT i.e. caching when accessed frequently across application ?

    1. Jitendra Avatar

      We are talking about data in hundred or Max thousands. I don’t think it would really have big impact on performance on querying small custom object vs getting cached data from Custom metadata.

  6. Kimberly Barnes Avatar

    Excellent information.
    A few things I consider when determining if I want a mdt or a custom object
    (1) Will the business will manage the information (custom object) or whether it will be managed by admins (mdt)
    (2) Will we need to report on the information? (custom object)
    We try to empower our business users to manage data that supports automated processes. Instead of providing elevated access to a set of users to manage mdt information, we put it in a custom object and provide access to that object. Keeps business involved and reduces work on admin staff. 🙂

  7. Ian Jamieson Avatar

    Thanks for the post, and it’s an interesting approach – we’ll look into it when looking to create a Custom Object.

  8. Grzegorz Skaruz Avatar

    Great comparison – I’ll recommend it in my SF newsletter –

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Jitendra Zaa

Subscribe now to keep reading and get access to the full archive.

Continue Reading