Data load is not completed successfully
Opened this issue · 6 comments
Hi,
I was using the territory-management-toolkit to convert one of our partial full sandboxes into Enterprise Territory Management and everything worked fine until the last point, the association data load.
When I executed the command:
$ fdx tmtools:tm2:load -s ~/sfdctm-pf5/
I got the following message:
Review Your Settings:
? Load TM2 Object/User Territory2 Association data using the above settings? Yes
Checking for Available Territory2 Model...
✔ Validate that the migrated Territory2 model is available (Active/Planning)
Loading TM2 Object/User T2 Association Data...
✔ Load User/Territory2 Association Data
✖ Load Object/Territory2 Association Data
In the tm2_dataload.json file I can see 2,000 errors like:
"sf__Error": "UNABLE_TO_LOCK_ROW:unable to obtain exclusive access to this record:--"
Usually this is related to multiple jobs running concurrently and trying to update the same record. How can I avoid it with the territory-management-toolkit?
Thanks a lot,
Istvan
@istvan-veeva what happens if you re-run the tmtools:tm2:load
command?
The re-run also failed, this time both the User/Territory2 Association and the Object/Territory2 Association:
Loading TM2 Object/User T2 Association Data...
✖ Load User/Territory2 Association Data
✖ Load Object/Territory2 Association Data
The error message in the tm2-dataload.json is:
"DUPLICATE_VALUE:duplicate value found: duplicates value on record with id: :--",
I think you will need to have an option like there is in Apex Data Loader to enable serial mode:
https://help.salesforce.com/articleView?id=loader_configuring_bulk_api.htm&type=5
@istvan-veeva - I think you're correct. I'll add this as an enhancement request.
The other thing that I think we need is the ability to retry a partially successful data load. The failure of the User/T2A data when you ran the second time didn't hurt anything, but it doesn't look good.
Thanks for reporting this and suggesting serial mode.
I agree, it would be helpful to be able to re-run the dataload task as many times as needed.
After dataload task has finished, you have the ObjectTerritory2Association.csv.failedResults and ObjectTerritory2Association.csv.successfulResults files; I think you just have to convert the failedResults file into the data csv file and leave out the successful records.
@istvan-veeva I've created #21 to track this enhancement request.