Skip to main content
All CollectionsTroubleshootingSalesforce validation errorsSalesforce validation errors
Resolving validation errors - "Test only deployment cannot update a field from a MasterDetail to Lookup"
Resolving validation errors - "Test only deployment cannot update a field from a MasterDetail to Lookup"

Cause and resolution to this Salesforce validation error; including workarounds for when the issue happens in your Pipeline workflow

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 MasterDetail to Lookup.

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

Resolution when deploying via '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.


Workarounds 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.

Workaround 1

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 and the PR still errors, then you'll need to consider deploying the change via a Compare and deploy (outside your Pipeline workflow) without validating before the deploying to target.

Workaround 2

If workaround 1 doesn't work and PR still fails the validation, try workaround 2.

  • Step 1
    Run a manual comparison (in Compare and deploy, so outside your Pipeline) between your feature branch that promotes the change(s), and the target Salesforce org of the CI job.
    Deploy the change(s), so that they're present in the org.

  • Step 2
    Merge the feature branch (PR) via Pipeline to the environment branch. In this scenario, CI job won't need to deploy anything to the org because you have deployed the change(s) manually in the previous step.

If the second step above doesn't work as expected, repeat the step by deploying directly from your feature branch to the environment branch (source of the CI job) using 'Compare and deploy' instead.

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?