(214) 269-3461 sales@appshark.com
  • Facebook
  • Twitter
  • linkedin
  • wit
  • Facebook
  • Twitter
  • linkedin
  • wit
AppShark
  • Home
  • About
  • Products
    • AppExchange Apps
      • Open SMS Pro
      • AppShark Connect
    • Connectors
      • OneView Connect
      • Bank Connect
      • RingCentral Connect
    • Bolts
      • Media Bolt
    • Packages
      • Yealink Autodialer
      • Postgres Connector
  • Services
    • Salesforce Consulting Services
      • Salesforce Developers & Consultants
      • Salesforce Implementation Services
      • Development
      • Admin & Support
      • Staffing
      • Nonprofits
      • Salesforce Integration Services
        • Salesforce Microsoft Dynamics Integration
        • Salesforce MuleSoft Integration
        • Salesforce Quickbooks Integration
    • Expertise
      • Sales Cloud
      • Service Cloud
      • Marketing Cloud
      • Einstein
      • Community Cloud
      • Salesforce CPQ
      • Pardot
    • Salesforce Managed Services
      • Salesforce Marketing Cloud Service
      • Salesforce Managed Services
    • Salesforce Consultants
    • Salesforce Health Check
    • Software Development Services
  • Blog
  • Contact
Select Page

Custom Meta Data Types

by Madhusudhana Reddy Guda | Jul 28, 2016 | Cloud, Custom Development, General | 0 comments

Custom Meta Data Types

While deploying any functionality or application to another org either by using change sets or packages we can deploy only Meta data like Custom Objects, Apex Classes, Visualforce Pages and Custom Settings but the record data like instances of Custom Objects and Custom Settings cannot be included.

After installing the package we need to also undertake some post install activities like configuring master data for the application.

By using Custom Metadata Types we can migrate configuration data (records) from one org to another org very easily at the time of deployment by using packages or Metadata API tools. It will definitely reduce the amount of effort required to populate records required by an application.

Custom Metadata Types are similar to our salesforce objects or custom settings.

Custom metadata types support the following custom field types.

• Checkbox

• Date

• Date and Time

• Email

• Number

• Percent

• Phone

• Picklist

• Text

• Text Area

• URL

It has a list of custom fields to hold Meta data records in addition to records which object and custom settings are holding.

The Custom Metadata records can be enquired about just like normal records using SOQL and it does not count into SOQL queries for each Apex transaction.

The Custom Metadata Type has a suffix of __mdt instead of __c (for Custom objects/fields).

Here I will try to explain how we can get the country names based on the country codes in visualforce pages. Below is the scenario where every developer generally uses list type Custom Setting to store the mapping of Country Codes and Country Names.

Develop ->Custom Metadata Types -> New Custom Metadata Type

1

Visibility means who will be able to see the type:

• Public—anyone can see it.

• Protected—if the type is installed as part of a managed package, only Apex code in that managed

package can use it

2

Create a field called Country Name of type Text

3

Let us create some data so that it displays in our Visualforce page. You can click on Manage button and further click on New to create the records (Similar to creating records in Custom setting).

4

Next step is to build a Visualforce page which shows the Country Codes and Country Names and the controller required to build that.

Apex Class

public with sharing class MetaDatatypeDemoCC {

public list<Country_Settings__mdt>getCountrySetting(){

return [Select DeveloperName,MasterLabel, Country_Name__c from Country_Settings__mdt];

}

}

Visual Force Page

<apex:page controller=”MetaDatatypeDemoCC”>

<apex:pageblock>

<apex:pageblockTable value=”{!CountrySettings}” var=”country”>

<apex:column value=”{!country.MasterLabel}”/>

<apex:column value=”{!country.DeveloperName}”/>

<apex:column value=”{!country.Country_Name__c}”/>

</apex:pageblockTable>

</apex:pageblock>

</apex:page> Here is the screenshot of the Visualforce page

5

By checking log files the method which queries the Custom Metadata Type does not count towards the governor limits. Since custom metadata types are metadata rather than data, they leverage all the tools Force.com already has for managing, packaging and deploying metadata. It is extremely useful if you are building package-able apps.

Recent Posts

  • Increase Abandoned Cart Conversions and Drive Revenue With Marketing Cloud
  • Salesforce Managed Services Considerations
  • Youreka For Healthcare: Overview, Features & Implementation
  • Setting Up Salesforce Health Cloud the Right Way
  • Setting up Salesforce Marketing Cloud: The Complete Guide

Recent Comments

  • Pallavi on Salesforce ZoomInfo Integration: The Complete Guide
  • Jim Swan on Salesforce Test Automation: Overview, Challenges, Tools & Best Practices
  • Zivoke on Benefits of Salesforce AWS Integration
  • Mike Jones on A Step By Step Method of the Custom Software Development Process

Categories

AppShark HQ

3939 Belt Line Rd
Suite 575
Addison, TX 75001

(214) 269-3461
sales@appshark.com

Navigate

  • Blog
  • Case Studies
  • eBooks
  • Webinars
  • Careers
  • Contact Us

Salesforce Services

  • Salesforce Managed Services
  • Salesforce Implementation
  • Salesforce Integration
  • Salesforce Development
  • Salesforce Consulting
  • Salesforce Remote Staffing

Top Guides

  • Mailchimp Salesforce Integration
  • Pardot Implementation Guide
  • Sage Salesforce Integration
Copyright. All Rights Reserved © 2022
Privacy Policy