Suppose I have records exported from source which includes records which are already in partial sandbox (Salesfoce Ids will be same for such records in source and partial sandbox) and some new records which are not present in partial sandbox. I performed Upsert on partial/full sandbox based on salesforce Id instead of using external Id. Update was successful for existing records but insertion failed with error.

Error: INVALID_ENTITY_FOR_MATCH_OPERATION_ERROR]. Message [invalid cross reference id]

Is it not possible to insert records into partial sandbox by performing upsert operation based on Salesforce ID (to find existing records)?

1 Answer 1


Upsert statement works like this:

  1. If the key is not matched, then a new object record is created.

  2. If the key is matched once, then the existing object record is updated.

  3. If the key is matched multiple times, then an error is generated and the object record is neither inserted or updated.

In your case, you've exported records from other source and trying to upsert it in your full/partial sandbox. Let me remind you that record Id'sare different in different org.

So if you're upserting any record from one org to another org & if record Id is present then there 99.9% chances that it won't match with the target org record Id's. This will eventually throw an exception which you're getting.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .