I have a use case where I need to do a one-time data update for around 1.8 Million records. I know that we can achieve this with a data loader or we can create an Apex Batch to achieve this.
Challenge in Data Loader,
I have to update a field with other fields substring from the same object,
List<ObjectA> lstObject = [SELECT Id, Field1, Field2 FROM ObjectA];
List<ObjectA> lstObjectUpdate = new List<ObjectA>();
for(ObjectA ob : lstObject) {
ob.Field1 = Id.ValueOf(ob.Field2.substring(0, 18));
lstObjectUpdate.add(ob);
}
if(lstObjectUpdate.size()>0) {
update lstObjectUpdate;
}
I don't think we can achieve this in using Data Loader.
Challenge in Batch Apex
Actually we don't have any challenge, but we don't have to write a batch for one-time data update.
Is there any other way I can achieve this in the Production environment?