{"id":7646,"date":"2022-10-29T00:25:24","date_gmt":"2022-10-29T04:25:24","guid":{"rendered":"https:\/\/www.jitendrazaa.com\/blog\/?p=7646"},"modified":"2022-11-05T14:37:59","modified_gmt":"2022-11-05T18:37:59","slug":"when-to-use-custom-metadata-vs-custom-object","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/when-to-use-custom-metadata-vs-custom-object\/","title":{"rendered":"When to use Custom Metadata vs Custom Object"},"content":{"rendered":"\n<p class=\"justify\">This question seems pretty easy and a decision could be straightforward in choosing <a href=\"https:\/\/www.jitendrazaa.com\/blog\/tag\/custom-metadata-types\/\">Custom metadata <\/a>vs Custom Object. However, I wish it could have been that easy, it&#8217;s not as simple as choosing between black &amp; white color. <\/p>\n\n\n\n<p>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 <a href=\"https:\/\/help.salesforce.com\/s\/articleView?id=sf.custommetadatatypes_limits.htm&amp;type=5\">reaching 10 Million character limits<\/a> in Custom Metadata. <\/p>\n\n\n\n<p>As I advise them on what are my thumb rules, thought to put a quick &amp; very simple blog post. I would welcome all of your feedback &amp; comment in this blog post to see if I can improve recommendations. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Controlling Application Behavior<\/h3>\n\n\n\n<p>If you want your customizations or configurations to behave differently depending on this data, then choose &#8211;  <strong>Custom Metadata<\/strong>. Examples could be an On-Off switch for the trigger, assigning a queue on basis of the configured region, etc. <\/p>\n\n\n\n<!--more-->\n\n\n\n<h3 class=\"wp-block-heading\">2. Need to use in Validation rule, Formula <\/h3>\n\n\n\n<p> If there is a need to use data in the Validation rule, formulas, flows, etc then choose <strong>Custom Metadata<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Data Maintained by System Admin or Business Users<\/h3>\n\n\n\n<p>If data needs to be maintained by business users who would not have access to Setup &amp; Configurations then use <strong>Custom Object<\/strong>. If data needs to be updated &amp; managed by the System admins only, we can <strong>still use custom objects<\/strong> &amp; control visibility using profiles or permission sets. This is really not a strong case for using custom metadata. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Reporting or Refer to existing custom or standard object <\/h3>\n\n\n\n<p>Custom metadata does support <a href=\"https:\/\/help.salesforce.com\/s\/articleView?id=sf.custommetadatatypes_relationships_limits.htm&amp;type=5\">parent-child relationships<\/a> 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 <strong>custom object<\/strong>. <\/p>\n\n\n\n<p>Another important aspect is reporting capability needs. If we want standard Salesforce reports to work, we would need <strong>Custom Object.<\/strong> <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. Moving data between orgs<\/h3>\n\n\n\n<p>Custom metadata can be deployed using tools like changeset, and <a href=\"https:\/\/www.jitendrazaa.com\/blog\/tag\/sfdx\/\">SFDX<\/a>. However, I still don&#8217;t see it as a enough strong reason to use the custom metadata. We can always have a <a href=\"https:\/\/www.jitendrazaa.com\/blog\/tag\/cli\/\">command line data loader<\/a> to load records or an Apex class to read static resources and load data if needed. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">6. Governor Limit on the volume of records &#8211; Important<\/h3>\n\n\n\n<p>In my opinion, this is the <strong>most important<\/strong> 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 &amp; 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. <\/p>\n\n\n\n<p>The Governor limit is <a href=\"https:\/\/help.salesforce.com\/s\/articleView?id=sf.custommetadatatypes_limits.htm&amp;type=5\">10 million characters<\/a> for custom metadata, and you might think it&#8217;s more than enough. Let me give you an example breakdown :<\/p>\n\n\n\n<p>Let&#8217;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. <\/p>\n\n\n\n<p>The <strong>thumb rule<\/strong> that I follow is &#8211; 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.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">7. Encryption need<\/h3>\n\n\n\n<p>Custom metadata <a href=\"https:\/\/help.salesforce.com\/s\/articleView?id=sf.custommetadatatypes_limitations.htm&amp;type=5\">does not support encryption<\/a>. If you are in the healthcare industry and security, compliance is paramount, you might need to go with Custom Objects.<\/p>\n\n\n\n<p>Above are 7 areas I evaluate and depending on the overall score, it makes things clear on what to choose between custom metadata &amp; custom objects. <\/p>\n\n\n\n<p>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. <\/p>\n\n\n\n<p> However, feel free to add some other dimensions that could help or impact your decisions. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>When &#038; how to choose between Custom metadata &#038; custom object<\/p>\n","protected":false},"author":1,"featured_media":7649,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[348,531,256],"class_list":["post-7646","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-salesforce","tag-best-practices","tag-low-code","tag-point-and-click"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2022\/10\/Custom-Metadata.png?fit=2240%2C1260&ssl=1","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":5070,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/dependent-picklist-in-salesforce-flow-using-custom-metadata-type-video\/","url_meta":{"origin":7646,"position":0},"title":"Dependent picklist in Salesforce flow using Custom Metadata type &#8211; Video","author":"Jitendra","date":"December 7, 2015","format":false,"excerpt":"Salesforce flow is great alternative for Visualforce pages used by admin. I have written, multiple blog post on Salesforce flow already and in this post we will discuss how we can create dependent picklist in Flow. If you are already using flow, might know that creating dependent picklist is not\u2026","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Salesforce flow - Dependent picklist output","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/12\/Salesforce-flow-Dependent-picklist-output.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":6209,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/how-to-retrieve-and-deploy-custom-metadata-types-using-ant\/","url_meta":{"origin":7646,"position":1},"title":"How to Retrieve and Deploy Custom Metadata Types using ANT","author":"Jitendra","date":"August 27, 2017","format":false,"excerpt":"Using Salesforce ANT Migration toolkit to retrieve and deploy custom metadata types with record. Sample Package.xml and ANT script included.","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Sample of Package.xml to deploy Custom Metadata Types","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/08\/Sample-of-Package.xml-to-deploy-Custom-Metadata-Types.png?fit=1051%2C330&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/08\/Sample-of-Package.xml-to-deploy-Custom-Metadata-Types.png?fit=1051%2C330&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/08\/Sample-of-Package.xml-to-deploy-Custom-Metadata-Types.png?fit=1051%2C330&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/08\/Sample-of-Package.xml-to-deploy-Custom-Metadata-Types.png?fit=1051%2C330&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/08\/Sample-of-Package.xml-to-deploy-Custom-Metadata-Types.png?fit=1051%2C330&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":4174,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-questions-part-22\/","url_meta":{"origin":7646,"position":2},"title":"Salesforce Interview Questions &#8211; Part 22","author":"Jitendra","date":"December 1, 2015","format":false,"excerpt":"Consider it Facts or FAQ or interview questions but its small and important notes about Salesforce. More than 200 interview questions for Salesforce developer, Admin and consultants","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"220+ Salesforce Interview Questions","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/11\/220plus-Interview-Questions-1024x303.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/11\/220plus-Interview-Questions-1024x303.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/11\/220plus-Interview-Questions-1024x303.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":5595,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/dynamically-remove-xml-content-from-metadata-before-salesforce-deployment-using-xmltask-video\/","url_meta":{"origin":7646,"position":3},"title":"Dynamically remove XML content from metadata before Salesforce deployment using xmlTask &#8211; Video","author":"Jitendra","date":"August 18, 2016","format":false,"excerpt":"Example - automatically remove listview before deployment","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Using XMLTask in ANT for Salesforce Deployment","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/08\/2016-07-15.png?fit=922%2C519&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/08\/2016-07-15.png?fit=922%2C519&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/08\/2016-07-15.png?fit=922%2C519&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2016\/08\/2016-07-15.png?fit=922%2C519&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":5949,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/state-country-picklist-in-salesforce-supporting-alpha-3-iso-code\/","url_meta":{"origin":7646,"position":4},"title":"State &#038; Country picklist in Salesforce supporting Alpha-3 ISO code","author":"Jitendra","date":"March 22, 2017","format":false,"excerpt":"How to use Integration Value in State & Country picklist in Salesforce","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"State & Country Picklist in Salesforce","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/03\/State-Country-Picklist-in-Salesforce-1024x299.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/03\/State-Country-Picklist-in-Salesforce-1024x299.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/03\/State-Country-Picklist-in-Salesforce-1024x299.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/03\/State-Country-Picklist-in-Salesforce-1024x299.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":6353,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/use-metadata-api-with-salesforce-dx\/","url_meta":{"origin":7646,"position":5},"title":"Use Metadata API with Salesforce DX","author":"Jitendra","date":"November 12, 2017","format":false,"excerpt":"How to use SalesforceDX to deploy metadata in Sandboxes or Non-Scratch Salesforce instances","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Use Metadata API or Package.xml with Salesforce DX","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Use-Metadata-API-or-Package.xml-with-SFDX.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Use-Metadata-API-or-Package.xml-with-SFDX.png?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Use-Metadata-API-or-Package.xml-with-SFDX.png?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Use-Metadata-API-or-Package.xml-with-SFDX.png?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Use-Metadata-API-or-Package.xml-with-SFDX.png?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/7646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=7646"}],"version-history":[{"count":4,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/7646\/revisions"}],"predecessor-version":[{"id":7656,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/7646\/revisions\/7656"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media\/7649"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=7646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=7646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=7646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}