Saturday, August 16, 2025

How to Handle Records Owned by Inactive Users in Salesforce

If you’ve ever deactivated a Salesforce user and then realized their records are now locked away from the rest of the team, you’re not alone.

This issue pops up most often when the Org-Wide Default (OWD) for an object is set to Private, meaning only the record owner (or someone above them in the role hierarchy) can access it.

When that owner becomes inactive, those records are still technically in the system — but invisible to most users.

Let’s look at how to fix this for both existing records and for future departures.


1. Reassigning Records from Inactive Users

If you have records already stuck under inactive owners, here are your options:

Option A – Mass Transfer Records (Clicks, Not Code)

Salesforce has a built-in tool for certain standard objects:
Setup → Data Management → Mass Transfer Records

  • Pros: Quick, no coding needed.

  • Cons: Limited object coverage; custom objects aren’t supported here.

Option B – Data Loader (For Any Object)

  1. Export all records owned by the inactive user.

  2. Update the OwnerId field to the new active user.

  3. Reimport the updated file.

  • Works for both standard and custom objects.

Option C – Apex Script (For Admins/Devs)

If you’re comfortable with code, you can reassign with a simple script:

List<Account> accs = [SELECT Id FROM Account WHERE OwnerId = '005XXXXXXXXXXXX']; for (Account a : accs) { a.OwnerId = '005YYYYYYYYYYYY'; // New owner } update accs;

This is the fastest option for large volumes or complex criteria.


2. Speeding Things Up: Defer Sharing Calculations

When you transfer ownership of a large number of records in a Private OWD org, Salesforce recalculates sharing rules for each record as it’s reassigned.
This can slow the process to a crawl.

Solution:

  • Temporarily defer sharing rule recalculation while you make bulk ownership changes.

  • In Setup → Sharing Settings, check the option "Defer Sharing Calculations" before you start the transfer.

  • Perform the ownership updates (via Mass Transfer, Data Loader, or Apex).

  • Once all updates are done, manually recalculate sharing by clicking "Recalculate".

Benefits:

  • Bulk transfers complete much faster.

  • Prevents multiple redundant recalculations.

  • Reduces strain on the system during large migrations.

Note: While sharing is deferred, users may temporarily see outdated access permissions until you recalculate.


3. Planning for Ongoing Departures

If 10 users leave every month, doing this manually is a nightmare.
Here’s how to make it automatic and painless:

Step A – Create a Deactivation Checklist

Before deactivating a user:

  1. Reassign their open opportunities, leads, and cases.

  2. Transfer ownership of key records to a manager, queue, or holding user.

  3. Remove them from active automation and approval processes.

  4. Enable “Defer Sharing Calculations” before making bulk changes.

Step B – Automate the Reassignment

  • Flow: Create a flow that asks for a “Replacement Owner” when a user is deactivated and automatically transfers their records.

  • Apex Batch: Schedule a nightly job that finds inactive owners and moves their records to a default user or manager.

  • AppExchange Tools: Consider apps like Mass Transfer Plus for more flexibility and scheduling.

Step C – Design for Prevention

  • Use Queues for operational records like Cases and Leads so they’re not tied to a single person.

  • Adjust sharing rules or role hierarchy so managers can still see records when someone leaves.

  • Avoid “single point of failure” ownership where possible.


Best Practice Summary

  • For existing inactive owners: Use Mass Transfer Records or Data Loader to reassign.

  • For speed: Defer sharing calculations until all transfers are complete, then recalculate.

  • For future: Automate the process with Flow, Apex, or AppExchange tools.

  • Preventively: Use queues, sharing rules, and thoughtful role hierarchy to reduce the need for transfers.


Final Thought:
Inactive users don’t have to mean inaccessible data.
With a solid offboarding process, deferred sharing calculations, and the right automation, you can keep your Salesforce data flowing — even when your team changes.

No comments:

Post a Comment