Loading
Upcoming Mandatory Changes to Public Key Infrastructure (PKI)Read More
Salesforce Enforces New Security Requirements in Summer 2026Read More

Encountering "Invalid Type" Error When Deploying Apex Classes Referencing Life Sciences Objects to Production

Publish Date: Jul 6, 2026
Description

This article explains how to troubleshoot deployment failures that occur when Apex classes reference Salesforce Life Sciences Cloud or Health Cloud standard objects that are not available in the target production org.

Objects such as ResearchStudyCandidate are provisioned only when the corresponding Life Sciences functionality has been enabled. During deployment, Apex classes are compiled against the metadata available in the target org. If the referenced object does not exist, compilation fails and the deployment is blocked.

Depending on the deployment, you may encounter one or more of the following errors:

  • Invalid type: ResearchStudyCandidate
  • Attempt to de-reference a null object

This issue can occur when deploying metadata using Change Sets, Salesforce CLI, Metadata API, DevOps Center, or other supported deployment tools.

Resolution

This issue occurs because the target production org does not contain the required Life Sciences metadata at compile time.

Common reasons include:

  • The required Life Sciences Cloud or Health Cloud feature has not been enabled.
  • The corresponding product entitlement or license is not provisioned in the target org.
  • Apex classes or other metadata reference standard objects that are unavailable in the production environment.
  • Sample or legacy Apex code references objects that were available when the code was originally created but are no longer provisioned.

 

To resolve the deployment failure:

  1. Verify that the target production org has the required Life Sciences Cloud or Health Cloud features and entitlements provisioned.
  2. Review the deployment errors to identify the Apex classes or metadata referencing the unavailable object.
  3. Remove or refactor code that references objects not available in the target org, if those objects are no longer required.
  4. If the functionality is required, work with Salesforce Support to ensure the appropriate product entitlement has been provisioned before deploying the metadata.

After the required metadata is available or the code has been updated to remove unsupported references, retry the deployment.

Knowledge Article Number

005388474

 
Loading
Salesforce Help | Article