
Andrew Hanna

Andrew Hanna

Short answer: Decide who owns each field before the first release, because that choice is hard to walk back. Make values customers will tune subscriber editable, keep values your code depends on upgradeable, treat picklist values and protected record names as permanent, and test every upgrade against an org that already holds customer edits.
A custom metadata upgrade breaks a subscriber in one of three ways:
All three trace back to packaging decisions made before the first release, not to the deployment command. So the safe path starts with the type definition.
Every field on a packaged custom metadata type carries one of three settings, as Salesforce's Trailhead unit on protecting custom metadata explains:
Rule of thumb: if a customer will ever want to tune the value, make it subscriber editable and accept that you can no longer correct it in their org. If the value encodes how your code behaves, keep it upgradeable. Reserve locked for values that must never move. Note that subscriber editable fields on protected records are locked after release, so plan protection and manageability together.
In second-generation managed packages, removed custom metadata records are marked as deprecated if they are visible to the subscriber org and hard deleted otherwise, according to Salesforce's guide to removing metadata components from 2GP packages. Deprecated components remain until a subscriber admin deletes them, and the Setup Audit Trail logs what the upgrade removed. Two consequences:
If you plan your package model from scratch, our guide to switching Salesforce DevOps tools without breaking your pipeline covers keeping package history intact through a tooling change.
Metadata.Operations.enqueueDeployment and a
Metadata.DeployCallback class, and Salesforce limits how many of these
deployments can be queued at once.
When two branches edit the same .md-meta.xml record, follow our guide to
resolving Salesforce metadata merge conflicts without losing anyone's work.
Yes, in a smaller way. Internal teams deploy custom metadata records between sandboxes and production too, and deploying a record from source overwrites the target's copy. If admins tune records directly in production, the next deploy from Git silently reverts them. Either make Git the only place those records change, or keep admin-owned records out of the deployment. Our guide to helping admins deploy without touching Git shows how to give them a tracked path instead of direct edits.
Serpent is the Salesforce DevOps platform built by Tekunda. It deploys custom metadata through the same reviewed pipeline as the rest of your metadata, with AI code review and a human approval before production, so a manageability or picklist change gets a second pair of eyes before it ships. Compare Serpent plans, or browse more SF Guides on packaging and CI/CD.
Will a package upgrade overwrite subscriber custom metadata values?
Only on upgradeable fields. Package upgrades never override values a subscriber changed in a subscriber editable field.
Can I delete a picklist value from a packaged custom metadata type?
No. After release you can add picklist values, but you can't delete or deactivate existing ones.
Can Apex update custom metadata records?
Yes, but not with DML. Use Metadata.Operations.enqueueDeployment, which
deploys asynchronously and reports back through a callback class.
Who makes Serpent?
Tekunda builds Serpent, a Salesforce DevOps platform with CI/CD, AI code review and human-approved deployments.
Commitment free!