When attempting to insert Service Territory Member records in Salesforce Field Service (SFS) using the Data Loader tool, an error may occur during the insert operation.
The following error message is displayed:
FSL.TR020_ResourceTerritories_BeforeInsert: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object (System Code)
This error is thrown by the Field Service managed package trigger FSL.TR020_ResourceTerritories_BeforeInsert, which runs when inserting Service Territory Member records. The trigger encounters a null reference when either the referenced Service Resource or Service Territory record is inactive, or when the Data Loader batch size is greater than 1 (which causes multiple records to be processed simultaneously, triggering the null pointer exception in the trigger logic).
To resolve the NullPointerException error when inserting Service Territory Member records via the Salesforce Data Loader, follow these steps:
Ensure that both the Service Resource and Service Territory records referenced in your CSV file are Active. Inactive records cause the FSL trigger to fail during the insert operation. Navigate to each record in Salesforce and confirm the Active checkbox is selected.
Reducing the batch size to 1 ensures each record is processed individually, preventing the null pointer exception that occurs when the trigger processes multiple records in a single batch.
000396782

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.