How can I mass delete 10000s entries of a custom r...
# ask-stanley-ai
s
How can I mass delete 10000s entries of a custom record?
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To mass delete 10000s entries of a custom record, you have a few options: 1. Mass Update Script: You can use a Mass Update Script to delete the records. Here is a sample script:
Copy code
javascript
/**
 * @NApiVersion 2.1
 * @NScriptType MassUpdateScript
 * @NModuleScope Public
 */
define(['N/log', 'N/record'], function(log, record) {
    function each(params) {
        const { type, id } = params;
        record.delete({ type, id });
    }

    return { each };
});
You can deploy this script on the record to be deleted, then use the native Mass Update feature to select the record to be deleted and let the script handle it. 2. Scheduled Script: You can create a cleanup script for this kind of scenario. Add a temporary checkbox to the records you want to delete and mark it true, create a saved search to isolate them, run a scheduled script against the search and delete them. After the deletion, you can remove the temporary checkbox. 3. Delete Record Definition: If you don't need to keep any record for that custom record, you can import the custom record definition into a SDF project, delete the record definition (which deletes all records), and then import the custom record definition from your SDF project. However, this method is not suitable if you have some records you want to keep. 4. Custom Record: Alternatively, you can create a custom record, upload into it the internal id of the records you want to delete, and then script the delete based on the custom record. Please note that deleting a large number of records can be a resource-intensive operation and may impact the performance of your NetSuite account. It's recommended to perform such operations during off-peak hours.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.854717553
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.851487398
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.850816727
Please provide your feedback on this answer.