Salesforce empties the database with truncate

Source: Internet
Author: User

If you want to quickly empty the table in MySQL, you can use the truncate command.
Truncate is able to quickly and easily erase data without any differences.

The syntax for using truncate in MySQL is
TRUNCATE table [table Name];

The Truncate feature is also available in Salesforce. However, just providing a button does not provide any code and the way the API calls truncate.
So the right scenario should only be used to quickly erase temporary data or test data. After all, it takes a lot of time to delete all of the data, whether using batch or Dataloader.

If you want to see the Truncate button in Salesforce, you need to agree to the following conditions, refer to the official documentation:

    1. Profile, administrative Permissions, Customize application-True
    2. User Interface, Setup, Enable Custom Object Truncate-True


Then on the detailed screen of the custom object, you can see the Truncate button next to the Edit,delete button appears.

However, it is not possible for any object to be truncate in any case, as the following requirements refer to the official documentation:

    1. Cannot be master-detail by another object, or in the master position in a.
    2. Cannot be referenced by the report snapshot.
    3. You cannot have a custom field that is either index or external ID.
    4. The skinny table cannot be opened. (Something about skinny table will be written in another article).


Why this is a limitation, obviously, is related to the truncate action in Salesforce.
In Salesforce, although the TRUNCATE function is similar to MySQL, it is used to empty the data in the table, but it causes the ID prefix of the custom object to change. All functions that refer to this custom object through the three-bit ID prefix will be invalidated. If Apex/vf/button has a logic that directly uses the 3-bit ID prefix for judgment, it will be affected.

Beyond that, the other thing with MySQL is that if there is a self-increment field. After MySQL is truncate, the counter for the self-increment field is reset. and Salesforce doesn't. Yes, although the ID has changed, the number of self-increment fields will not return to the starting value.

Overseas Sync Address: Https://wp.me/p3i9xe-bG

Salesforce empties the database with truncate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.