Data Deployment Error: INVALID_CROSS_REFERENCE_KEY : Record Type ID

When doing a data deployment, Salesforce may return the following error:


When Copado sets the RecordTypeId field, it needs to set a record type that is valid for the profile of the user doing the deployment. Even for a user with Modify All Data turned on, it is possible to restrict the set of valid record types, although this behavior is not usually the default.

The RecordTypeId field is used to set the record type of the records that are being deployed. Copado fills in this value by looking at the record type names on both the source and destination and using the record type with the same name on both sides. If there's no such record type, the field will be left blank. This will force Salesforce to use the default record type for the deployment user.



  1. If it's important that the records have the correct record type. Then you'll need to ensure the user in the destination organization has all of the appropriate record types assigned:

    1. Log into the destination organization and navigate to Setup > Manage Users > Profiles

    2. Open the profile of the user that will be used to perform the deployment.

    3. Under the Custom Record Type Settings section, open the settings for any record type needed for the deployment. For each record type, adjust the Selected Record Types so that it contains the Master record type (or, alternatively, all the available record types).
      Selecting the Master record type ensures that Copado can add any record type ID to new records and makes it easier to perform similar data deployments in the future if new record types are added.

  2. Do not check the Match Record Type checkbox. The record type ID will be left blank, and Salesforce will set it as the default for the deployment user. If the record type does not need to be set correctly, this approach should make the deployment succeed.

How did we do?