0

I tried using apex data loader and Dataloader.io

So i knew i need to enable Insert Null values option in apex data loader settings but it isn't working for the fields with Number data type. I am receiving invalid number: NULL as an error. Is there any workaround or tool which can be used.

  • This import is on production. So, I can't use anonymous window.
  • I have specific set of records and it is a recurring task so can't write can't apex.
2

You are getting this error because, you might have used the text NULL in the column mapped with the number field.

With the setting "Insert Null values" checked in data loader, you will have to leave the column empty for the field where you want NULL to be updated and data loader will null out the respective fields where the column was left blank.

  • Thanks, It worked. – Venky Apr 4 at 7:21
0

An alternative to @Vijay's answer - if it's not a big dataset, you could just run the following script in the Anonymous Apex Execution:

List<My_Object__c> records = [SELECT Id, Number_Field__c FROM My_Object__c WHERE Number_Field__c != null];

for (My_Object__c record : records)
    record.Number_Field__c = null;

update records;

If you're dealing with a big dataset, you could write a quick Batch Job with this small script. I generally like using a Batch Job utility class to add quick jobs of this nature for mass updates, and it's easy to execute via Database.executeBatch(new MyJob('massClearNumberFields'));

  • I need to make this import on production so can't use anonymous window. – Venky Apr 4 at 7:08
  • You can use Anonymous Apex in Production! Try it on a trivial record :-) – Brian Miller Apr 4 at 7:19

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.