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
SFDC TechSFDC Tech 

Account Billing Address clean up

Hi,

We are working on cleaning up of Account Billing Address.
How can we approach this project?


Thanks!

shiv@SFDCshiv@SFDC
Go to setup > Admin manel > devleop > Apex Calss
Click on new

Pase Below code :
global class RemoveBillingInfo implements Database.Batchable<sObject>{

	global Database.QueryLocator start(Database.BatchableContext BC){
      String query = 'SELECT Name, BillingStreet, BillingCity, BillingState, BillingPostalCode,BillingCountry, BillingLatitude, BillingLongitude FROM Account' ;
	  return Database.getQueryLocator(query);
    }
	
	global void execute(Database.BatchableContext BC, List<Account> AccountList){
		 for(Account act : AccountList){
			
			act.BillingStreet = '';
			act.BillingCity = '';
			act.BillingState = '';
			act.BillingPostalCode = '';
			act.BillingCountry = '';
			act.BillingLatitude = '';
			act.BillingLongitude = '';
		 }
		 update AccountList;
    }
	
	global void finish(Database.BatchableContext BC){

    }

}
Click on save.
Now go to your Name on top bar/ Navigation bar. Select Developer Console.

After opening developer console. Press CTRL + E
New small window will be opened.

paste following code in this.
 
RemoveBillingInfo obj = new RemoveBillingInfo();
Database.executeBatch(obj) ;
Click on execute button. and wait for some time becuase batch class takes some time to execute and process the reocrds becuase it is a bulk operation.

If above answer helps you to done the task. Please select answer as a solution.