What Is Custom Metadata type In Salesforce - All You Need to Know
Salesforce has added Custom metadata Setting types on the platform in In Summer 15
Custom metadata type is Similar to custom setting and custom objects except for this deployable environment. In Custom metadata type records are considered metadata rather than data. You don't need to import or export data, instead, we can deploy. Your reusable functionality reads your custom metadata type and makes use of it to produce customized application behavior. All custom settings facts are exposed inside the utility cache, which permits efficient access without the value of repeated queries to the database. Custom settings are stored in cache memory means easy to access your query on metadata it will not count with governor limits. With the help of custom metadata, we easily avoid hardcoded id.
With the help of Metadata API to perform updates and create tasks programmatically.
Protected custom metadata types and public custom metadata types both behave like public custom metadata when they are outside of a managed package.
Don't forget to check out: An Introduction to Salesforce Force.com Migration Tool (ANT)
Advantage of custom metadata Type
- Page layout can be used in Custom metadata type.
- Validation Rules can be used in the Custom meta type .
- We can create Lookup relationships to other custom metaData types like custom objects.
- We can create easily picklist fields in custom metaData type.
- There is no Governor limit in SOQL query.
- Datastore in cache memory which increases the performance of the organization.
- Custom metadata types are noticeable in test class without "SeeAllData" annotation.
- Custom metadata are readable for all profiles, including the guest user in a public case.
- Custom metaData types return 50,000 records per transaction.
- There is no limit for SQL query per transaction.
- 100 records or fields per custom metaData.
Disadvantage of custom metadata Type
- Like custom setting, custom metaData type also don't have an option to create a custom tab.
- Custom metaData type Need to query to get data.
- Custom metaData type does not support formula field data types.
- Custom metaData type does not support Global picklists.
- A single Organization can Only allow to create 100 Custom Metadata Types.
Get Custom metaData type data
List <exmpl_mdt> sobject = [ select Name from exmpl_mdt];
Check out another amazing blog by Ayush here: How to Use Custom Settings in Salesforce | The Developer Guide
Difference between Custom metadata type and Custom setting
Custom metaData | Custom setting |
|
|
Steps for custom metaData types
Go to Setup > Quick find Box > Enter Custom metaData type>
Click New > For Label Enter “your Choice” and for Object Enter “Your choice” and save.
References: blog.bessereau, iseesystems.com, success.salesforce.com