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.
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.
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.
• 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
• 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
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.
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
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`
005384469

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.