Custom metadata types in Salesforce get treated as configuration, not data, so most masking tools walk right past them. That distinction is a technical convenience, not a legal one. If a custom metadata record stores a real customer name, a support contact's personal email, or a test account tied to an actual employee, it travels into every sandbox refresh untouched, right alongside the fields your masking policy dutifully scrubbed on the Contact and Lead objects.
This gap exists because of how Salesforce built the platform, not because anyone designed it to leak PII. But designed or not, the leak is real, and it is worth understanding exactly how it happens before deciding your masking coverage is complete.
Why Custom Metadata Looks Like Config But Holds Data
Custom Metadata Types (CMDT) were introduced so admins could deploy reference data, like feature flags, mapping tables, or environment settings, through the metadata API instead of hand-loading records after every deployment. That is genuinely useful. A CMDT record deploys with your package, survives a sandbox refresh, and behaves like a managed setting rather than a row in a database.
The trouble starts because CMDT records support the same field types as any other object: text, email, phone, lookup. Nothing stops an admin from building a Support Escalation Contacts metadata type with a Name field and an Email field, then populating it with the actual names and inboxes of three people on the support team. It is config from Salesforce's point of view. It is personal data from GDPR's point of view, and GDPR does not grade on intent.
Where PII Actually Hides in Custom Metadata
Teams rarely set out to store PII in CMDT. It accumulates because metadata types are flexible and admins reach for them whenever they need a reference table. Here is where we typically find it during an audit:
- Approver and escalation mappings that list named individuals and their direct emails instead of a queue or role reference.
- Integration user configs where a sandbox integration account was cloned from a named production user, keeping that person's username pattern and email domain.
- Fallback contact records used in error-handling flows, pointing to a real admin's email so failed automations have somewhere to notify.
- Test data seeds stored as CMDT so Apex tests can reference a consistent record, often copied from a real customer record during initial build.
- Partner and vendor contact tables that list named representatives at external companies, which counts as third-party personal data too.
None of these are exotic. They are the kind of shortcuts every org accumulates over several years of admin turnover, each one reasonable in isolation.
Why Standard Masking Tools Skip It
Masking platforms, including most of the market, run their transformation pass against data retrieved through the Bulk API or SOAP API after a sandbox refresh completes. That is the right approach for standard and custom objects, because that is where production-style records live. Custom metadata, however, is deployed through the Metadata API or Tooling API as part of a package, and it is version-controlled and packaged more like Apex code than like a Contact record.
A masking job scoped to sObject queries simply never sees CMDT records as a target, because they do not show up in a typical data-masking scan the way Account or Case records do. The tool completes its run, reports success, and the CMDT records sail through unchanged. Nobody gets an error, because from the tool's perspective there was nothing to mask.
This is the part admins find hardest to accept: your masking vendor is not lying when it reports a clean run. It is simply scoped to a layer of the platform that does not include CMDT by default. Closing that gap is a configuration decision your team has to make deliberately.
The Compliance Angle Under GDPR
Article 5 of GDPR requires data minimization and purpose limitation. A sandbox environment that still contains a real support rep's personal email, three years after that rep left the company, fails both principles even if the rest of the org is masked immaculately. Article 25's privacy-by-design requirement goes further, expecting technical measures that prevent this kind of residual exposure by default, not as an afterthought discovered during an audit.
Auditors and regulators do not distinguish between an sObject record and a custom metadata record when assessing whether personal data was processed in a non-production environment. The API path a field travels through is an implementation detail. What matters is whether a human being's identifiable information sits in an environment with broader access, weaker monitoring, and often no deletion policy at all.
I'd argue this is actually a sharper risk than unmasked Contact records in some ways, because CMDT records are rarely reviewed. Nobody runs a weekly report against custom metadata the way they might against Account or Opportunity data. It sits quietly, deployed and forgotten, until someone exports a package and notices a real name in a field labeled Escalation_Contact__c.
How to Close the Gap
Start with an inventory, not a tool purchase. Pull a list of every custom metadata type in the org and flag any with Email, Phone, Text, or Long Text Area fields that could plausibly hold a person's details. This takes an afternoon in a mid-sized org and a day or two in a large one with years of accumulated metadata.
For each flagged type, ask a simple question: does this field need to reference a real person, or would a role, queue, or generic alias do the job just as well? Most escalation and fallback contact fields can point to a shared mailbox or a Salesforce Queue instead of a named individual, which removes the PII problem at the source rather than masking around it.
Where a real reference genuinely can't be avoided, like a test seed record that Apex tests depend on structurally, build a masking step into your deployment pipeline that overwrites those specific CMDT records post-refresh using the Metadata API or a scripted Tooling API call. This is exactly the kind of policy extension we build into MaskEzee's masking rules for clients who've found CMDT exposure during an audit: treat the metadata layer as an in-scope target, not an exception.
Document the decision either way. If a CMDT field is deliberately left unmasked because it contains no real PII, note that in your masking policy so the next admin does not have to re-investigate it from scratch. If it does get masked, record which pipeline step handles it and how often it is verified. A masking policy that only covers sObjects and silently assumes metadata is clean is not a complete policy. It is half of one.
Frequently Asked Questions
Do custom metadata types count as personal data under GDPR?
Yes, if the fields contain information that identifies a living person, such as a name or personal email address. GDPR defines personal data by content, not by which Salesforce API stores it. A custom metadata record with a real individual's contact details is subject to the same minimization and protection rules as a Contact record.
Why don't Salesforce sandbox masking tools cover custom metadata types by default?
Most masking tools scope their transformation jobs to sObject data retrieved through the Bulk or SOAP API, since that is where standard production-style records live. Custom metadata is deployed through the Metadata API as part of a package, which places it outside the typical data-masking scan. Closing that gap requires an explicit policy decision, not a default setting.
How do I find out if my org has PII stored in custom metadata?
Pull a list of all custom metadata types and review any fields typed as Email, Phone, Text, or Long Text Area. Check whether those fields are populated with real names, emails, or other identifiable details rather than generic roles or queues. This audit typically takes a few hours in most orgs and surfaces the obvious cases quickly.
Can I just replace named contacts in custom metadata with a queue or alias?
In most cases, yes, and it is the cleanest fix. Escalation contacts, fallback notification addresses, and approver mappings usually work fine pointed at a Salesforce Queue or a shared mailbox instead of a named individual. This removes the PII exposure permanently rather than requiring ongoing masking after every refresh.
What happens if test data seeds require a real customer record for Apex tests to pass?
That is a sign the test data seed itself needs to be rebuilt using synthetic data rather than a copy of a production record. If the dependency can't be removed immediately, add a scripted masking step to your deployment pipeline that overwrites the specific custom metadata records with fake values right after each sandbox refresh.