1

What I'd like to do is upload a csv file and have the resulting salesforce object match that csv exactly.

I can use upsert to modify and create new records, but the resulting object will contain old entries. Is there a way to remove records from an object if they do not match the source csv being uploaded?

1

Basically, no, the Data Loader can't do this. You would need either a paid tool that provides synchronization capability, or you'd have to delete the old entries that are left over as as separate transaction; upload the CSV, query records that haven't been modified in the past X amount of time, and then delete them. You could also write an Apex Code script to save a bit of time with the deleting part.

1

You would need to first delete all records and then insert the new records.

  1. Export all existing records.
  2. Use the export file as your data source for a Delete operation.
  3. Insert new records.

If you want to maintain CreatedDate and CreatedBy info, along with any data for fields you don't intend to overwrite, you'll have to add a step between 1 and 2 where you filter out the records yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.