Adminstrator · Salesforce

Truncate sObject records in Salesforce

Many developer’s are trying to delete whole sObject records using SOQL query like SQL  “Truncate table” but salesforce force.com platform doesn’t support that.

Truncate “Table/sObject” means logically equivalent to the Delete [Select Id From Account];.

Salesforce has option to truncate custom object records using Truncate button. By default you can’t see the Truncate button on the UI. You have to contact your administrator enable “Truncate” option.

Please follow steps to enable Truncate:-

  1. Go to Setup under your name on the right most corner.
  2. Type “User Interface” in QuickFind search box on the left.screen-shot-2016-12-21-at-11-29-07-am
  3. Click “User Interface” like and check “Enable Custom Object Truncate” flag to True.screen-shot-2016-12-21-at-11-28-38-am
  4. Click Save.
  5. Now you can see Truncate button on custom object. Once you clicked button data will be deleted from that object with in few seconds.screen-shot-2016-12-21-at-11-29-38-am

 

How data deleted from Salesforce in few seconds?
Once you clicked Truncate button - creating new table with same structure and renaming old table into "TableName_trunc".
Note: if you are not able to Truncate button on the custom object then check is there any custom indexed field exists then please create salesforce support case to remove fields custom index for that object.

Data storage not going to increase once you clicked Truncate button it will take 15 days to remove from your org. If you want to remove immediately then you need to create another salesforce support case.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s