User lookup fields can sometimes remain empty after a data deployment, despite no errors being reported and records being created successfully in the target org.
What causes the issue?
This behaviour typically occurs when deploying data that references User records into a target org where some of those Users are inactive.
β
In recent Salesforce releases, sandbox behavior has changed so that Users are inactive by default after a refresh, unless they are explicitly included in a designated public group at the time the sandbox is created. This means that Users who are active in Production may exist in the sandbox but be inactive, even though their records and IDs are present.
β
As a result, data deployments that reference Users can behave unexpectedly after a refresh. Records that include lookup fields to User such as Owner fields, Assigned User fields, approver fields, or custom User lookup fields may be inserted successfully, but the User lookup values may not be populated if the referenced Users are inactive in the target org.
Salesforce enforces constraints on lookup relationships to User records. If a record references a User who exists in the target org but is inactive, Salesforce may silently reject that field value while still allowing the record itself to be inserted or upserted.
Because the record operation succeeds, Gearset reports the deployment as successful, even though the lookup field is not populated.
Why the issue can appear inconsistent
You may notice that:
Some records populate the User lookup field correctly.
Other records have the lookup field left blank.
The total record count matches between source and target orgs.
This usually indicates that Users referenced by populated records are active in the target org.
How do I fix the issue?
There are a few ways to resolve this, depending on your setup and requirements.
Activate the required Users
Before running the data deployment identify which User records are referenced by the data you are deploying. In the target org, check whether those Users are marked as Active and Activate any required Users and then Re-run the data deployment.
Once the Users are active, Salesforce will allow the lookup fields to be populated correctly.
Review sandbox creation or refresh settings
If this occurs regularly after sandbox refreshes its recommend to review any sandbox settings that control which Users are activated by default. Ensure that Users required for data deployments are included in the relevant activation group or process. Consider documenting a standard post-refresh checklist that includes User activation verification.
β
Filter records as a temporary workaround
If activating Users is not immediately possible you can filter out records that reference inactive Users for the purpose of the deployment. This allows development or testing to continue while avoiding incomplete data.
Preventing the issue in future deployments
As a general best practice when deploying data that includes User lookup fields:
Always verify User activation status in the target org before deploying.
Be especially cautious after sandbox refreshes.
Treat User activation as a dependency, similar to required metadata or reference data.
