Activity Forums Salesforce® Discussions Difference between Custom Setting and Custom meta data in salesforce ?

  • Difference between Custom Setting and Custom meta data in salesforce ?

    Posted by Ayush on April 22, 2020 at 9:48 am

    Difference between Custom Setting and Custom meta data in salesforce ?

    MOHIT replied 4 years, 7 months ago 3 Members · 2 Replies
  • 2 Replies
  • Kirandeep

    Member
    April 22, 2020 at 2:13 pm

    Custom Settings have the same permission to edit the records and to edit the configuration. Both can be done with the "Configure Application" permission. With Custom Metadata, you can edit the records with "Configure Application" but you require "Author Apex" to edit the configuration.

  • MOHIT

    Member
    April 22, 2020 at 2:13 pm

    Only a few cases in which Custom Settings more useful. Custom Metadata types have a number of advantages that make them the correct choice to implement almost always.
    Advantages to Custom Metadata:
    1. Most importantly, as stated before, they are Metadata and thus deployable! No more annoying configuration after deployment, which you have to do with Custom Settings. They're also refreshed to sandboxes, so you don't need to create Apex classes to generate your default Custom Setting records.
    2. They have WAY more options that Custom Settings: picklist fields, long text areas (in Spring '17), page layouts, and validation rules (though as of Winter '17 these are not deployable either by change set or by migration tool - weird!)
    3. The beauty that is Metadata Relationships! You can create lookups between Custom Metadata objects. Additionally, you can create an Object Definition lookup - so you're relating Custom Metadata to Standard or Custom Object definitions. Additionally, in Spring '17 you can create a dependent lookup to a Field Definition on that object. (Documentation here)
    4. Custom Settings have the same permission to edit the records and to edit the configuration. Both can be done with the "Configure Application" permission. With Custom Metadata, you can edit the records with "Configure Application" but you require "Author Apex" to edit the configuration.
    5. Custom Metadata types have a lot of additional features specific to developing managed packages. You can configure the visibility and editability of fields an objects both by the org that installs the package and by upgrades to the package.
    Reason why you would use custom settings instead:
    ============
    1. Hierarchies - Custom metadata types do not purport to replace hierarchy custom settings which allow you to vary values based on users and profiles across the org. These custom settings can also be referenced in formulas, so can be used in formula fields, validation rules, workflow rules, and visualforce. (Documentation here)
    2. Web service credentials - If you’re using test credentials in a sandbox, you don’t have any reason to deploy them to production. More importantly, if you create a sandbox, you don’t want the config for the production versions of your Web Services being created automatically and used by default. However, it is usually best to use Named Credentials for this.
    3. Custom setting records’ values can be edited in code, while custom metadata cannot. If you will need to modify your configuration programmatically for any reason (say you’re creating a config console for the user), custom metadata will not work.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos