I am trying to restore a custom object from my backup where I am trying to upsert the records. Following this example. The external field is Id here. Assuming that there are no records matching, the CSV that uploaded contains Id fields. When I try to run the batch job, all the records that are received have the error message:
ENTITY_IS_DELETED:entity is deleted:--
Copy pasting where upsert would fail:
How Upsert Chooses to update() or create()
Upsert uses the external ID to determine whether it should create a new record or update an existing one:
If the external ID is not matched, then a new record is created. If the external ID is matched once, then the existing record is updated. If the external ID is matched multiple times, then an error is reported. When batch updating multiple records where the external ID is the same for two or more records in your batch call, those records will be
marked as errors in the UpsertResult file. The records will be neither created or updated.
The object contained no records and why does upsert fail where the expected operation is to create a new record? I understand that the upsert will create new ids, in case of upsert. In that case, will I be able to build a mapping with the old as well as new record ids?
The requirement is that a salesforce object exists and upsert the existing records that are in my backup to salesforce.
The external field id is the id of this object and not it's external field id.
I aggregated the records in the form of a CSV, tried upsert operations. It failed with the errors above. However, when the operation type is changed to insert. The records are inserted successfully. Doesn't upsert handle this scenario? Should I manually check for the presence of each record while inserting and then change the operation type accordingly (probably would have to resort to SOAP for this case)?