Is it possible to trigger a truncate of an object in Salesforce? As a job etc.? Deleting the data from an object needs the Ids to be cached/stored and then deleted from the Salesforce. Even using "BulkAPI" is proving to be too slow for us. I have heard that we can Truncate an object in Saleforce which is quite fast. How do we do that?

1 Answer 1


Currently there is no way to truncate the object using apex or API. There is an idea posted which you can up-vote so that Salesforce takes this up to deliver this in future releases.

One other way of doing this would be to do this using batch class which won't require you to hold the IDs and will asynchronously delete the records from the object. You can go through Asynchronous Apex trailhead module to get some further help on batch classes.

Note : The auto number fields won't get reset after deleting the records using batch apex i.e. using delete statements which does reset when truncating the object.

  • Thanks Vijay. We definitely need this feature through API. Upvoted the idea.
    – user70782
    Jul 16, 2019 at 8:33
  • @user70782 Hope this gets delivered in future releases. Jul 17, 2019 at 6:27
  • Hi @user70782 if this or any answer has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. Jul 23, 2019 at 12:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .