All Collections
Gearset for data sandbox seeding
Resolving data deployment errors: REQUIRED_FIELD_MISSING
Resolving data deployment errors: REQUIRED_FIELD_MISSING

This article explains when and why the REQUIRED_FIELD_MISSING error occurs, and how to fix it

David Runciman avatar
Written by David Runciman
Updated over a week ago

The REQUIRED_FIELD_MISSING error can happen during a data deployment if the object that you’re deploying includes a required lookup field and

  • you’ve chosen to exclude the object referenced by that field;

  • the referenced object was included in the same data deployment, but failed.

What causes the error?

Lookup fields on a Salesforce object are frequently used to associate two records together in a relationship.

If the lookup field is also a required field, it must have a value before a record can be saved. A custom lookup field is typically made a universally required field via a checkbox from the Salesforce UI as shown below:

Scenario 1: Gearset will not deploy the records from an object with a required lookup field if you have excluded the object referenced by the lookup field. The error is can be triggered if you attempt to deploy a detail object in a master-detail relationship while excluding the corresponding master object in the deployment.

Scenario 2: The referenced object was not deployed successfully, so we don't have a valid value to insert in the lookup field. In the screenshot above, if the deployment of the Opportunity records failed, we will not have a valid value (Salesforce ID) to insert in the field OpportunityID on the child object OpportunityLineItem.

How do I fix the error?

Scenario 1

The main way of avoiding this error is to make sure that you include the relevant dependencies in your deployment. After you have selected the primary object that you want to deploy records from, Gearset's data loader will ask you which related objects you want to include in the deployment. This is the second step of configuring your data deployment.

In the screenshot below, the objects listed under 1. How do you want to match existing records? on the left side of the screen are the objects already selected during the first step of the configuration. The objects listed under 2. Which related objects do you want to include? on the right side of the screen are all the other objects in the dependency hierarchy (i.e. a list of the dependencies of the dependencies) referenced by the primary objects on the left.

You will need to include the object referenced by the required field at this stage for Gearset to deploy the record to your target.

Alternatively, for the purpose of the deployment, you may choose to filter and exclude the record(s) that give rise to the error.

Scenario 2

In this case you can focus on solving the error that prevented a successful deployment of the parent object. The REQUIRED_FIELD_MISSING error on the child object will then be resolved automatically.

Did this answer your question?