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
Andrew Morales 1Andrew Morales 1 

Ignore Populated Fields on DataUpload/Upsert

Hello Brilliant People,

This may be a simple question with a complex answer.

Is there a way to update fields that are ONLY blank/null on update or upsert?

I am uploading a set of Contact records and I only want to update the field if it is blank or null. I dont want it to overwrite it if a value exists, if it is a blank value I want it to populate. If the Contact doesnt exist, I want it to create the record with all metadata.

And I dont think this matters, but I dont have the ContactID's so will be keying off of the email address.

Thank you as always for the help!
RaidanRaidan
You're right! It is a simple question with a complex answer :-)

I think the easiest solution is probably to export all Contact records and do your record matching and field population using Excel. Then you can do the upsert by email (make sure there is no duplicate email).

Another solution is to dump the data to a custom object (or use the external object, if you can set it up). Then write an Apex script in Developer Console to upsert the data. This is more complicated.