function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
K MamataK Mamata 

Salesforce CLI data import/export INVALID_FIELD_FOR_INSERT_UPDATE Unable to create/update fields: MasterRecordId.

Hi,

I am trying to export (from full copy sandbox) and import (to a developer sandbox) a simple use case of parent account and its child accounts. 
Belwo are my sfdx commands - 
sfdx force:data:tree:export --query "SELECT id, name, (select id, name from ChildAccounts) from account where name = 'ABC corp' limit 1" --prefix export-demo --outputdir sfdc-out -u ****@****.com.fullcopy --plan
sfdx force:data:tree:import --targetusername *****@*****.com.devsandbox --plan sfdx-out/export-demo-Account-plan.json

I get below error - 
INVALID_FIELD_FOR_INSERT_UPDATE  Unable to create/update fields: MasterRecordId. Please check the security settings of this field and verify that it is read/write for your profile or permission set.  MasterRecordId

Has anyone been successful doing this? Please help.
SFDC Coder 1SFDC Coder 1
Hi K Mamata,

MasterRecordId is a standard field which is not visible to any one but it can be accessile by using the metadata API. This field gets populated when ever we perform Merge action of any of the object (listed below).

Lead
Account
Contact

As per the query you have used and mentioned in description, system should not pick MasterRecordId field. I will suggest to use one more filter like "isdeleted = false" in query while retrieving the list of account.

I suppost this will resolve your issue.