error

Record Type Not Found — The referenced record type does not exist or is inaccessible.

What does this error mean?

This error occurs when Apex code, integrations, or automation attempts to use a Record Type that Salesforce cannot find or access.

Record Types control business processes and page layouts for objects. If the specified Record Type ID or DeveloperName is invalid or unavailable to the user, Salesforce throws this error.

Common Causes

1. Invalid Record Type ID

The Record Type ID used in Apex or integration is incorrect or no longer exists.

2. Record Type not assigned to profile

The running user’s profile does not have access to the specified Record Type.

3. Hard-coded Record Type IDs

Hardcoding Record Type IDs can break when deploying between sandbox and production environments.

4. Deleted or renamed record types

A Record Type may have been deleted or renamed in the organization.

How to Fix It

Solution 1 — Query Record Type dynamically

Apex

RecordType rt = [
    SELECT Id
    FROM RecordType
    WHERE DeveloperName = 'Customer'
    AND SObjectType = 'Account'
    LIMIT 1
];

Solution 2 — Avoid hard-coded IDs

Always query record types by DeveloperName instead of using static IDs.

Solution 3 — Check profile permissions

Navigate to:


Setup → Profiles → Record Type Settings

Solution 4 — Verify Record Type exists

Check Object Manager to confirm the Record Type is present and active.

lightbulb

Pro Tip: Use Custom Metadata or Custom Settings to store record type references instead of hard-coding them in Apex.