All Collections
Troubleshooting
Salesforce validation errors
Resolving validation errors - "Test only deployment cannot update a field from a Lookup to MasterDetail"
Resolving validation errors - "Test only deployment cannot update a field from a Lookup to MasterDetail"

Resolve validation error "Test only deployment cannot update a field from a Lookup to MasterDetail" in Compare and deploy or CI jobs

Quinn Kuiper avatar
Written by Quinn Kuiper
Updated over a week ago

Explanation of the error:

This Salesforce error that Gearset is surfacing is usually encountered when running a validation for a deployment package involving a change of a field that changes from a Lookup to a MasterDetail.

This is because Salesforce does not support this change for Validations to avoid data loss or corruption.

Resolution using Compare and Deploy:

To resolve this issue try deploying the package rather than validating it first. If you wish to test out the deployment, you can first deploy into another test sandbox, as a full deployment first includes a validation of the changes as part of the deployment procedure.

Resolution when using a CI job for deployment:

Note: This resolution also applies to CI job in Pipelines - in a scenario when the error happens on a Pull Request (PR) that has failed a validation.

If you're aiming to resolve this validation error without needing to deploy the change outside your Pipeline, try to disable the validation of Pull Requests targeting the source branch - this can be a temporary adjustment of your CI job settings for the purpose of that deployment.
โ€‹
On your CI dashboard select Edit settings... on the relevant CI job and disable below option:


If disabling this option doesn't help with the deployment, then you'll need to consider deploying the change via a Compare and deploy without validation. Unfortunately, we cannot bypass this error in any other way.
โ€‹

Further examples of this Salesforce validation error can be found here:

Disclaimer: This error is returned by Salesforce directly, rather than Gearset. Even so, we offer guidance based on our combined experience with the Metadata API. Where possible, we try to help guide you to fix or avoid this error. In the case that this isn't possible, we may need to direct you to Salesforce support for further clarification.

Did this answer your question?