Field History Tracking keeps a permanent log of every old value a tracked field ever held, and most masking tools only touch the current record. That means a customer's previous email address, their old phone number, or a changed name from three years ago can still sit in plain text inside a sandbox, long after the live field was scrubbed. Admins who treat masking as a field-level operation on the object itself routinely miss this history table entirely.

This isn't a theoretical edge case. Any org running Salesforce for more than a year has accumulated thousands of history records on Contact, Account, Lead, and Opportunity, and every refresh carries that history straight into the sandbox along with the rest of the data.

What Field History Tracking Actually Stores

Field History Tracking writes a row to a related history object every time a tracked field changes. For standard objects this lands in tables like ContactHistory or AccountHistory. For custom objects, Salesforce uses the generic CUSTOMOBJECT__History naming pattern. Each row stores the old value, the new value, the field name, the user who made the change, and a timestamp.

Up to 20 fields per object can be tracked this way, and orgs with Shield can extend that further with Field Audit Trail, which retains history for up to ten years instead of the standard 18 to 24 months. That extended retention is exactly the problem. The longer history lives, the more old PII accumulates, and none of it disappears just because someone updated the current record.

A Contact record masked today shows a fake name and a fake phone number. Query its history table in the same sandbox and you will often find the real name and the real phone number the field held before the last three edits. The current record looks clean. The audit trail behind it does not.

Why Masking the Current Field Isn't Enough

Most masking tools work by scanning object schemas, identifying fields flagged as PII, and overwriting them with synthetic values. That approach handles the object itself correctly. It rarely extends the same logic to the shadow history tables Salesforce generates automatically, because those tables are not always visible in the same schema view admins configure masking rules against.

The result is a split state: the Contact object is compliant, but ContactHistory is not. Anyone with read access to history data, including a developer debugging a workflow or a QA tester reviewing an audit trail feature, can see the real values that masking was supposed to remove.

This matters more for roles with field-level visibility that bypasses typical list views. Field history is often surfaced in related lists, in Lightning page layouts, and through SOQL queries run directly against the history object. None of those paths require special permission beyond standard object access, which most sandbox users already have.

The Compliance Exposure Under GDPR

GDPR's storage limitation principle under Article 5(1)(e) requires that personal data be kept no longer than necessary for the purpose it was collected for. Masking a current field value while leaving twenty prior values of the same field untouched is hard to defend as compliant, because the old values serve no business purpose in a test environment and were never meant to persist as test data.

Article 25's data protection by design requirement adds another layer. A masking policy built without accounting for history tables cannot claim to implement masking by design, since it leaves a known, predictable gap that any technically competent reviewer would find on the first query.

I'd argue this is one of the more defensible-sounding gaps that falls apart under actual scrutiny. "We mask all PII fields" sounds complete until an auditor asks whether that includes historical values, and the honest answer is often no.

Where This Breaks in Practice

Consider a sales rep who updates a lead's phone number four times over a year as the contact changes jobs. Each of those four real numbers lands in LeadHistory. A sandbox refresh pulls all four into the lower environment. Masking runs, replaces the current phone field with a synthetic number, and leaves the four historical entries exactly as they were.

The same pattern applies to name changes after a merger, email updates following a domain migration, or address corrections after a data cleanup project. Every one of those edits generates a history row carrying the original, real value forward.

ObjectHistory TableCommon Tracked FieldsTypical Retention
ContactContactHistoryEmail, Phone, MailingAddress18-24 months, up to 10 years with Shield
LeadLeadHistoryPhone, Email, Company18-24 months
AccountAccountHistoryName, BillingAddress, Phone18-24 months
Custom ObjectsCUSTOMOBJECT__HistoryAny tracked custom fieldConfigurable via Field Audit Trail

Orgs using Field Audit Trail for compliance reasons, ironically, make this worse. The entire point of that feature is long retention for audit purposes, which means more historical PII sitting in every sandbox that pulls from production.

What a Masking Policy Needs to Cover

A masking approach that stops at the object level leaves this gap open by default. Closing it requires treating history tables as first-class masking targets, not an afterthought bolted on after the main pass runs.

That means identifying every tracked field across every object, mapping each one to its corresponding history table, and applying the same masking logic, or a deterministic equivalent, to the OldValue and NewValue columns in that history record. Deterministic masking matters here specifically, because a history row showing three different fake emails for the same contact across three edits looks inconsistent and breaks any testing that relies on tracing a field's change pattern over time.

Admins should also check whether Field Audit Trail is enabled before assuming an 18-month retention window limits exposure. A ten-year retention policy on a tracked field means ten years of real PII riding along into every refresh until someone masks the history table directly.

How MaskEzee Handles History Data

MaskEzee scans tracked fields as part of its standard discovery pass and extends masking rules to the associated history tables automatically, rather than requiring a separate configuration step for each object. Old and new values in history rows get the same deterministic replacement applied to the live field, so a contact's masked email stays consistent across both the current record and every historical entry tied to it.

This runs as part of the same pre-refresh masking job, with no extra scripts and no manual SOQL cleanup after the fact. For orgs running Field Audit Trail with multi-year retention, that consistency matters even more, since the volume of historical PII scales with however long the org has been configured to keep it.

Field History Tracking exists to answer a simple question: what did this field used to say. A masking policy that forgets to answer that question in the sandbox as well as production isn't actually complete, no matter how clean the current records look.

Frequently Asked Questions

Does Salesforce masking automatically cover Field History Tracking tables?

No, most masking tools scan the object schema and mask current field values but skip the related history tables like ContactHistory and LeadHistory. Those tables store old values separately and need to be targeted explicitly in a masking policy. Without that step, historical PII survives the refresh even when the live record looks fully masked.

How long does Field History Tracking retain old PII values?

Standard Field History Tracking retains history for 18 to 24 months. Orgs using Shield's Field Audit Trail can extend that to as long as ten years, which means significantly more historical PII accumulates in every sandbox copy over time.

Can I just disable Field History Tracking in sandboxes to avoid the risk?

You can, but it usually breaks testing for any feature that relies on audit trails, change tracking workflows, or history-based reports. A better approach is masking the history data itself rather than removing a feature that QA and development teams depend on.

Which objects are most likely to expose real PII through history tables?

Contact, Lead, and Account are the most common sources since they carry the fields organizations track most closely, including email, phone, and mailing address. Custom objects with Field Audit Trail enabled can carry the same risk if any tracked field holds personal data.

Why does deterministic masking matter specifically for history data?

History tables often show the same field changing multiple times for the same record, and testers may need those changes to stay traceable. Deterministic masking replaces each real value with the same fake value every time it appears, so the pattern of changes stays usable for testing without exposing the original data.