forcedotcom / SFDX-Data-Move-Utility

SFDMU is a cutting-edge Salesforce data migration tool for seamless org population from other orgs or CSV files. It handles all CRUD operations on multiple related objects in one go.
BSD 3-Clause "New" or "Revised" License
444 stars 74 forks source link

[QUESTION] - Field Mapping is not working for ID field #747

Closed ruqianq closed 4 months ago

ruqianq commented 4 months ago

This question is related to https://github.com/forcedotcom/SFDX-Data-Move-Utility/issues/282, even though it marked as closed, but I dont see the confirmation.
I am trying to do the same load the legacy id into target org on different field under the same object. I am using simple insert operation, no need to do comparison. However, the legacy id field would got override by the ID. Apparently it start with the insert, then conduct an update, dont know why this is happening. Here is my code:

{ "operation": "Insert", "useFieldMapping": true, "query": "select Description, Fax, Id, Name, Phone, ParentId from Account" }

fieldMapping.csv ObjectName,FieldName,Target Account,,Account Account,Id,Legacy_Id__c

Screenshot 2024-05-01 at 4 49 10 PM
hknokh commented 4 months ago

Hello, @ruqianq

Thank you for reaching out. I will do my best to assist you as quickly as possible and will keep you updated on my progress.

Cheers

ruqianq commented 4 months ago

Hi I think I found out the root cause, and in fact my query miss one field 'ParentId' somehow that trigger the update after insert.

hknokh2 commented 4 months ago

Hello,

I hope this helps. Please let me know if you need further assistance.

Regards.

hknokh2 commented 4 months ago

By the way, I highly recommend using my SFDMU GUI Desktop App. It can really help you with configuring field mapping, creating and managing your export.json file, and launching jobs in general.

ruqianq commented 4 months ago

Thanks for the explanation, this is helpful. I have refactored my code, first job to conduct the insert first to populate the legacy id then the 2nd job to update the record with the parent id.

hknokh2 commented 4 months ago

Do you use objectSets?

ruqianq commented 4 months ago

correct

github-actions[bot] commented 4 months ago

This case has been marked as 'to-be-closed', since it has no activity for the 3 days.
It will be automatically closed in another 3 days of inactivity.

github-actions[bot] commented 4 months ago

This case has been closed, since it has no activity for the last 6 days. Feel free to reopen it, if you need more help.