Back to insights

Data Lifecycle, Deletion & Compliance

A Salesforce soft delete is not a retention policy

JSBC Labs8 min read

The record disappeared; the data lifecycle did not

An administrator deletes 40,000 expired application records and reports that the retention requirement is complete. The records no longer appear in ordinary list views, but some remain recoverable, related files still exist, an integration retains copies and a downstream warehouse has no deletion instruction. The user-interface action succeeded. The policy outcome did not.

The JSBC Labs position is that a Salesforce soft delete is not a retention policy. Salesforce places normally deleted records in the Recycle Bin, where they can be restored for 15 days; after that window, Salesforce schedules them for permanent deletion and does not guarantee the exact purge time. That behaviour is a valuable operational safety net. A retention policy must answer a much wider set of questions: why data is kept, for how long, which copies and relationships are in scope, what exceptions apply, who approves destruction and what evidence proves completion.

Start with purpose—not an object-age filter

‘Delete Cases older than seven years’ looks precise but may combine contractual evidence, complaints, regulated correspondence and disposable operational detail. Classify information by business purpose, legal basis, sensitivity and record category before setting a clock. The same object can contain fields with different obligations, while one customer journey can spread across Accounts, Contacts, Cases, activities, Files and custom objects.

Salesforce Well-Architected guidance treats classification as the driver for protection and retention, recommends removing data that no longer serves its collection purpose and recognises that erasure must respect lawful retention obligations. Convert that principle into a retention schedule with an accountable owner, trigger event, duration, disposition, exception rule and evidence requirement for each category. ‘Seven years after contract termination’ is a lifecycle rule; `CreatedDate < LAST_N_YEARS:7` is only a rough query and may delete too early or retain too long.

Map the deletion graph before touching production

Deletion follows relationships, not page layouts. Salesforce documents that deleting a master in a master-detail relationship also deletes its detail records. Restoration can also be asymmetric: some associations return, while a lookup relationship that has since been replaced may not. A child deleted through a parent can be invisible as a separate Recycle Bin item, and certain sequences can make the child unrecoverable. The visible parent count therefore understates both blast radius and recovery complexity.

Build an object-level deletion graph. Include cascade relationships, lookups, junctions, activities, ContentDocument links, emails, notes, history, sharing records, external IDs and custom integration keys. For each node, define delete, anonymise, retain, detach or archive. Test the graph with representative deep records, not clean fixtures containing one parent and one child. The design review should state which relationships must survive, which must disappear and how integrity will be reconciled after both deletion and restoration.

Choose soft delete, hard delete and anonymisation deliberately

Soft delete provides a recovery period and is appropriate when operational mistakes must be reversible. Bulk API Hard Delete bypasses the Recycle Bin and requires the specific Bulk API Hard Delete permission. Salesforce also distinguishes a hard delete from the later physical database removal process: sending a record to a purge queue is not the same as proving that every physical representation has already disappeared. Do not describe an API response as instantaneous physical erasure.

Anonymisation is often the better disposition when the business must retain an aggregate, transaction or legal record but no longer needs identifying attributes. Define which fields are transformed, whether the transformation is irreversible, how free text and files are handled and whether combinations of remaining fields can re-identify a person. Keep the mechanisms separate: soft delete supports recovery, hard delete accelerates purge, anonymisation preserves a reduced record and archival moves data elsewhere. Each solves a different policy outcome.

Make integrations consume deletion as a business event

A Salesforce record can be gone from the application while persisting in marketing platforms, data lakes, search indexes and service tools. Standard query endpoints omit soft-deleted rows, while Salesforce's `QueryAll` resource can return records deleted by delete or merge until they are permanently removed from the Recycle Bin. That makes `IsDeleted` useful for reconciliation, but a polling query is not a complete cross-system erasure contract.

Give every downstream system a declared retention role and deletion interface. Send an immutable tombstone containing stable identity, disposition reason, effective time and policy reference—never the sensitive payload being removed. Require idempotent processing, acknowledgements and exception queues. Decide what happens when a consumer is unavailable or an identifier has changed. Reconcile the source population against consumer receipts before closing the request. The policy is complete only when every authoritative and replicated copy reaches its intended disposition.

Backups must preserve recoverability without defeating erasure

Backup and retention create an intentional tension. A recovery copy must survive accidental deletion, yet restoring an old backup must not silently resurrect data that was lawfully erased. Salesforce Well-Architected reliability guidance recommends deliberate backup and recovery capabilities and warns when backup retention is shorter than regulatory requirements. Privacy architecture adds the opposite boundary: historical data should not be kept forever without legal purpose.

Maintain a deletion ledger outside the dataset being restored. After recovery, replay approved deletions and anonymisations before releasing the environment to users or integrations. Define backup expiry, encryption, access, restore testing and how subject requests apply to immutable copies. Salesforce Backup also documents restoration caveats, including that some restored records receive new IDs and some connective relationships are not restored. Test policy recovery as a business process, not merely whether a CSV can be imported.

Turn deletion into a controlled production release

Large deletes can trigger cascades, automation, sharing recalculation, locks and integration traffic. Run a discovery query first, freeze its criteria, count by object and policy category, then sample records with business owners. Use a staged workflow: approve candidates, quarantine where appropriate, execute in bounded batches, verify side effects and purge only after the recovery window has served its purpose. Hard-delete permission should be narrowly assigned to a dedicated workload identity, not left on a general administrator profile.

Rehearse failure at every boundary. What happens after three batches succeed and the fourth fails? Can reruns distinguish already processed records? Do triggers or Flows recreate data? Are external deletes retried safely? Is there a stop condition when the candidate count changes unexpectedly? Treat the runbook, queries, approvals and reconciliation scripts as versioned release artefacts. A retention job that cannot be paused, explained and resumed is a destructive script, not governance.

Prove the outcome with evidence—not an empty list view

For every execution, record policy version, approved scope, query checksum, counts by disposition, batch results, downstream acknowledgements, exceptions and purge state. Separate ‘not visible’, ‘recoverable’, ‘queued for purge’, ‘anonymised’ and ‘verified complete’; collapsing them into ‘deleted’ creates false assurance. Restrict the evidence so it proves control without becoming another uncontrolled copy of personal data.

Monitor coverage as well as throughput: records with no classification, objects missing a retention rule, orphaned files, consumers without acknowledgements and restored environments awaiting deletion replay. Review exceptions with legal, security and data owners on a defined cadence. The Recycle Bin remains an excellent defence against human error, but it is only one state in a governed lifecycle. The architecture earns trust when the organisation can explain why data exists, where every copy lives and how its final disposition was verified.

Official references

Continue reading