How to Truncate Custom Objects Records in Salesforce



Truncating custom objects is a way to permanently remove all of the records from a custom object, while keeping the object and its metadata intact for future use. Truncating is useful, for example, if we have created a custom object and filled it with test records. When we are done with the test data, wecan truncate the object to purge the test records, but keep the object and put it into production. This is much faster than batch-deleting records and possibly recreating the object.

IMPORTANT : Truncating custom objects causes some irreversible changes to the truncated object and its records. Before truncating, see Truncating Custom Objects. Then, enable it for our organization by entering User Interface in the Quick Find box, selecting User Interface, and then selecting the permission.

Enabling truncate for custom objects

Before using this feature for our organization, we must enable it. To do this, follow these instructions:

1. Navigate to Setup | Build | Customize | User Interface.

2. On the user interface page, navigate to the Setup section.

3. Select the Enable Custom Object Truncate checkbox, as shown in the following screenshot:

4.  Click on Save.

Performing truncate for custom objects

we can use this feature when we have created a custom object and filled it with test records. To delete those test records with a single action, we can use this feature.

To perform this action, follow these instructions:

1. Navigate to Setup | Build | Create | Objects.

2. Identify the object on which we want to perform this action and click on an object name to go to its detail page. In our case, select Event Object.

3. Click on the Truncate button, as shown in the following screenshot:

4. It will pop up a window. Read the warning message carefully and type the

object name as shown in the following screenshot:

5. Click on the Truncate button to complete the process.

Note: When we truncate a custom object, Salesforce stores a copy of the truncated object in the deleted objects’ list for 15 days, and it will count against our organization’s limit. After 15 days, the records will be erased permanently and will no longer count against our limits.

Reference : https://help.salesforce.com/articleView?id=sf.dev_object_trunc.htm&type=5

For more blogs : https://merfantz.com/blog/


1 Comments