87 / 100 SEO Score

How to Add Custom Metadata Records in Change Set Salesforce

How to Add Custom Metadata Records in Change Set Salesforce

Introduction: Custom Metadata Records in Change Set Salesforce

Salesforce provides powerful configuration tools that allow teams to customize applications without writing extensive code. One of the most valuable yet often misunderstood features is Custom Metadata Types (CMDT). Custom Metadata Types allow you to store configuration data that can be deployed, versioned, and referenced in Apex, Flow, Validation Rules, and more. However, many Salesforce professionals struggle with one specific challenge: how to move Custom Metadata Records using Change Sets. Unlike custom objects or custom settings, Custom Metadata behaves differently during deployment.

This guide explains what Custom Metadata Types are, why Change Sets work differently, and how to successfully add and deploy Custom Metadata Records using Change Sets in Salesforce, step by step.

What Are Custom Metadata Types in Salesforce?

Custom Metadata Types are metadata-driven records used to store application configuration data. These records behave like metadata rather than data, which means:

Common use cases include:

Unlike Custom Settings, Custom Metadata Types are deployment-friendly and protected from accidental deletion.

Understanding Custom Metadata Records vs Custom Objects

Before working with Change Sets, it’s important to understand the difference:

Custom Metadata Records vs Custom Objects

Because Custom Metadata Records are metadata, they must be handled differently during deployment.

Why Custom Metadata Records Don’t Automatically Appear in Change Sets

One of the most common misconceptions is assuming Custom Metadata Records behave like custom object records. In reality:

If the metadata type itself is missing in the target org, record deployment will fail.

Prerequisites Before Adding Custom Metadata Records to a Change Set

Before proceeding, ensure the following:

  1. You have created the Custom Metadata Type
  2. At least one Custom Metadata Record exists
  3. You have deployment access to both source and target orgs
  4. The Custom Metadata Type is not protected (unless deploying via managed package)
  5. The record is saved and activated
Step-by-Step: How to Add Custom Metadata Records in Change Set

Step 1: Create or Verify the Custom Metadata Type

Navigate to:

Setup → Custom Metadata Types

Confirm:

If the metadata type does not exist in the target org, you must deploy it first.

Step 2: Create Custom Metadata Records

Go to:

Setup → Custom Metadata Types → Manage Records

Create one or more records:

Only saved records can be added to Change Sets.

Step 3: Create an Outbound Change Set

Navigate to:

Setup → Change Sets → Outbound Change Sets

  1. Click New
  2. Enter a meaningful name
  3. Add a description
  4. Save the Change Set

Step 4: Add the Custom Metadata Type

This step is critical.

  1. Open the Change Set
  2. Click Add
  3. Select Custom Metadata Type
  4. Choose your metadata type
  5. Add it to the Change Set

Without adding the metadata type itself, records will not deploy correctly.

Step 5: Add Custom Metadata Records to the Change Set

Now add the records:

  1. Click Add again
  2. Select Custom Metadata
  3. Choose the specific records you want to deploy
  4. Click Add to Change Set

Each record appears as an individual component.

Step 6: Add Dependencies (If Required)

Custom Metadata Records may be referenced by:

Click View/Add Dependencies and confirm all required components are included.

Step 7: Upload the Change Set

  1. Select the target org
  2. Click Upload
  3. Wait for the upload to complete

Salesforce will validate the metadata before deployment.

Deploying Custom Metadata Records in Target Org

Once uploaded:

  1. Log into the target org
  2. Navigate to Inbound Change Sets
  3. Locate your Change Set
  4. Click Validate (recommended)
  5. Click Deploy

After deployment:

Common Issues and How to Fix Them

Issue 1: Custom Metadata Record Not Visible in Change Set

Cause

Solution

Issue 2: Deployment Fails Due to Missing Metadata Type

Cause

Solution

Issue 3: Field-Level Errors During Deployment

Cause

Solution

Issue 4: Protected Custom Metadata

Cause

Solution

Best Practices for Deploying Custom Metadata via Change Sets

1. Always Deploy the Metadata Type First

Never deploy records without ensuring the type exists.

2. Use Clear Naming Conventions

Consistent labels and developer names simplify debugging.

3. Limit Environment-Specific Values

Avoid hardcoding URLs or credentials. Use Named Credentials when possible.

4. Validate Before Deploying

Validation helps catch missing dependencies early.

5. Keep Records Modular

Smaller records are easier to maintain and deploy incrementally.

When NOT to Use Change Sets for Custom Metadata

While Change Sets work well, they have limitations. Consider alternatives when:

In such cases, Metadata API or DevOps tools may be more efficient.

Custom Metadata Records vs Custom Settings Deployment
Custom Metadata Records vs Custom Settings Deployment

Salesforce recommends Custom Metadata for modern configuration management.

Key Takeaway:

Custom Metadata Types are a cornerstone of scalable Salesforce architecture. When used correctly, they eliminate hardcoded logic, improve maintainability, and simplify deployments across environments.

Understanding how to add Custom Metadata Records in Change Sets ensures smoother releases, fewer deployment errors, and cleaner configuration management. By following the correct order metadata type first, records second and validating dependencies, Salesforce Admins and Developers can deploy configuration changes confidently.

Whether you’re managing feature flags, integration rules, or dynamic business logic, mastering Custom Metadata deployment is a critical Salesforce skill in modern orgs.

Contact Us
Loading
Your message has been sent. Thank you!
© Copyright iTechCloud Solution 2024. All Rights Reserved.