I have a Text Area (Long) field that was encrypted so I am unable to convert it to a Text Area (Rich) field. Therefore, I created a new Text Area (Rich) field and would like to update all Account records so that the Rich Text field = Long Text field.
Below is the code I am using. The
.replaceAll('\n', '<br/>');
to preserve formatting.
List<Account> accList = [SELECT RichText__c, LongText__c FROM Account];
List<Account> accListToUpdate = new List<Account>();
for(Account a : accList)
{
a.RichText__c = a.WM_LongText__c.replaceAll('\n', '<br/>');
accListToUpdate.add(a);
}
update accListToUpdate;
However, I am getting the following error:
System.NullPointerException: Attempt to de-reference a null object
How can I update all of the records?
Additionally, we have over 100k records that need to be updated. Would this approach work? Or would it require something else?