Loading

Field Service: ServiceAppointment records orphaned after sandbox refresh

Publish Date: May 19, 2026
Description

Summary

ServiceAppointment records can lose their ParentRecordId values during sandbox refresh operations, causing data integrity issues that prevent Gantt chart access and trigger System.NullPointerException errors when attempting to delete related AssignedResource records.

Scope

This article covers ServiceAppointment records that lose ParentRecordId values specifically after sandbox refresh operations in Field Service Lightning (FSL) orgs. For other ServiceAppointment data issues, managed package installation errors, or Gantt chart configuration problems not related to orphaned records, see related Field Service articles.

Description

In Field Service Lightning orgs, ServiceAppointment records can become orphaned during sandbox refresh operations, losing their required ParentRecordId field values that typically link to WorkOrder records. This data corruption affects core Field Service functionality including Gantt chart access and record management operations.

Symptoms

• ServiceAppointment records show empty ParentRecordId fields after sandbox refresh
• Gantt chart becomes inaccessible or displays errors
• Deletion of AssignedResource records fails with `System.NullPointerException`
• Error message: `CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: FSL.TR021_AssignedResource_BeforeDelete: execution of BeforeDelete caused by: System.NullPointerException: Attempt to de-reference a null object`
• Dispatcher console shows validation errors when attempting record operations

Known Limitations

• The backend repair process requires Salesforce Support intervention and cannot be performed by org administrators
• All affected ServiceAppointment records will initially receive the same temporary ParentRecordId value
• Individual ParentRecordId corrections must be made manually after the initial repair
• This issue may recur with future sandbox refresh operations until addressed in the platform refresh process

Resolution

Cause

Sandbox refresh operations can corrupt the ParentRecordId relationships between ServiceAppointment and WorkOrder records in Field Service Lightning (FSL) orgs. The ParentRecordId field is required for ServiceAppointment records but becomes null during the refresh process, creating orphaned records. When Field Service managed package triggers attempt to process these orphaned records, they encounter null pointer exceptions because the expected parent record relationships are missing.

Resolution

To resolve this issue, Salesforce Support must perform a backend data repair to restore the missing ParentRecordId values on the affected ServiceAppointment records. This process cannot be performed by org administrators and requires Salesforce Technical Support intervention. Once the backend repair is complete, org administrators must manually reassign individual ParentRecordId values to their correct WorkOrder associations.

Contact Salesforce Support for backend data repair:

1. Open a case with Salesforce Technical Support and provide your org ID
2. Request a scrutiny process to identify and repair orphaned ServiceAppointment records
3. Provide a valid WorkOrder ID that can serve as a temporary ParentRecordId for all affected records
4. Support will execute the backend repair process to restore ParentRecordId values
5. After the repair, update individual ParentRecordId values to their correct WorkOrder associations as needed

Verification Steps

1. Navigate to the Gantt chart in Field Service to confirm access is restored
2. Attempt to delete test AssignedResource records to verify trigger functionality
3. Run a SOQL query to confirm ServiceAppointment records have populated ParentRecordId values: `SELECT Id, ParentRecordId FROM ServiceAppointment WHERE ParentRecordId = null`

Knowledge Article Number

005384469

 
Loading
Salesforce Help | Article