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 Answers 2

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.

1
  • Thanks, It worked.
    – Venky
    Commented Apr 4, 2019 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'));

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

You must log in to answer this question.

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