NetSuite Mass Delete Tool

07/13/2018

Removing data from NetSuite is a common request in my line of work. While Techfino is known for its ability to safely backup and remove files using CleanSweep File Manager, and transactions/records using CleanSweep Archive & Purge, in some cases a full blown SuiteApp isn’t what is required. In cases where data just needs to be removed from the system whether its test data, duplicated data, invalid data, or just unwanted data you can leverage the solution that we’re conveniently sharing as a public bundle. These requests can cause undue stress, especially in a production environment, and call for a developed process to ensure nothing outside of the desired criteria is purged.

Executive Summary

The NetSuite Mass Delete Tool allows administrators to bulk-delete records — such as transactions, custom records, and other NetSuite objects — without requiring a full SuiteApp like CleanSweep. Built using SuiteScript, the tool provides a configurable interface for selecting record types and filtering by criteria before executing a deletion. Techfino shares this as a practical utility for NetSuite admins who need efficient data cleanup without the overhead of a full archiving solution.

After an angry phone call, or two in my case, you start to develop a process to get proper alignment on what needs to be deleted. Techfino follows a structured process when it comes to this activity:

  1. Identify the data to be deleted with a report (saved search usually)
  2. Review data from report with account owner to obtain sign off
  3. Run a deletion script that utilizes the saved search in question as input to ensure nothing else is deleted
  4. Schedule follow up review with account owner to ensure data was removed properly

To safely streamline this process, I created a map/reduce script that runs off a saved search.

The script uses 1 parameter, “Saved Search” and automates everything else. Simply edit the deployment and click save and execute to fire the script on demand. The saved search is loaded, and each result is deleted based on its internalid and record type.

Please Note:  If your saved search returns lines on a transaction with mainline = 'F', the script will delete the entire transaction, not just the lines returned by the saved search.

Deploying only involves creating the Map Reduce script, the script parameter and the saved search to use for the process. Below, we provide two options for deploying this Map Reduce script, the first option is easy to install via a bundle so you don’t have to be a developer to use this option. The second option, allows users to install our script in the event that the user does not have permission to install a bundle and is able to deploy and run SuiteScripts.

How to Install and use the Mass Deletion Bundle:

  1. Install the Techfino Mass Deletion Bundle
  2. Create a non-summarized public saved search with criteria set to capture all records that should be deleted
  3. Navigate to the ‘TF | Mass Record Delete (MR)’ script deployment and set the Saved Search script parameter to the search from step #2
  4. Click save and Execute on the script deployment to initiate the deletion process

How to Deploy Manually:

  1. Add the Map / Reduce and library files to the file cabinet
  2. Create a new Map / Reduce script
  3. Create a script parameter for the script with the id: ‘_tf_saved_search’ so the final name will be ‘custscript_tf_saved_search’
  4. Deploy the script setting the saved search under parameters and the concurrency to the desired amount. Keep in mind you need to set the saved search as “public” and have other visibility considerations (i.e. role) for it to be an option for the script parameter.

FAQ

Q: I have a lot of data to remove. Can this script handle large loads?

A: The script is very scalable, I have yet to find a search / dataset it times out on. I designed the script to run chunks of the saved search in the map stage instead of the whole search in the getInputStage to theoretically allow any input without timing out. A common use case is deleting all transactional data in a system and the script hasn’t timed out in these use cases.

 

Q: Will the script timeout after 60 minutes?

A: No. Map / Reduce has some complicated governance rules but the script doesn’t time out as it does not spend 60 minutes in getInputData or Summarize stage. All the work is done in manageable chunks in the map and reduce portion of the script to prevent timeout.

Bg Image

White paper

title-continuedsuccess-2

What if NetSuite support actually worked?

See the Continued Success difference.

Get the Whitepaper

 

Q: Some records did not delete. What happened?!

A: Most likely errors are preventing records from being deleted. While slowing down the process, every record delete action is wrapped in a proper try catch statement in case of failure to ensure the script deletes as much data as is possible and completes. The logs will detail what error NetSuite returned. In most cases this is due to related records preventing deletion. For example, contacts would need to be deleted before deleting customers due to the dependency linkage.

 

Q: I want to delete everything though, even related records. Is there a way I can set the script to deleted related records too?

A: I plan to add this feature in the future.

 

Q: I used a summary search and it’s not working

A: Currently the script is designed to only work with non-summarized searches so any grouping and summarizing will not provide valid input.

 

Q: How fast is it?

A: This varies depending on a lot of factors: level of customization on the records, number of processes running at any given time, type of records being deleted, concurrency limit and much, much more. Below are some screenshots showing some examples of runtime

85,000 custom records being deleted in 5 minutes utilizing 10 queues

NS ss2

91,000 transaction records (sales orders/invoices) being deleted in 5 hours 50 minutes utilizing 5 queues

NS ss1-1

We’ve helped a number of Clients with this solution and we’re sure you’ll find a ton of value in using this. If you do use our solution, we would greatly appreciate you commenting here to let us know how it helped you out!

Talk to a NetSuite Expert

Tell us what you're working on, and we'll help you figure out the next step.

Frequently Asked Questions About the NetSuite Mass Delete Tool

What is the NetSuite Mass Delete Tool?

The NetSuite Mass Delete Tool is a SuiteScript-based utility that enables administrators to delete large volumes of NetSuite records in bulk. It provides a configurable interface for selecting record types and applying filters, then processes deletions in batches — useful for data cleanup scenarios that don't require a full archiving solution.

What types of records can be deleted with the NetSuite Mass Delete Tool?

The tool can be configured to delete most NetSuite record types that support the delete operation via SuiteScript — including custom records, transactions (where permitted), contacts, leads, and other standard NetSuite objects. Some records may be restricted from deletion depending on your NetSuite configuration and accounting period status.

How is the NetSuite Mass Delete Tool different from CleanSweep?

CleanSweep Archive & Purge is a full SuiteApp with advanced scheduling, audit logging, backup, and compliance features designed for enterprise data lifecycle management. The Mass Delete Tool is a lighter-weight script solution for situations where you simply need to bulk-delete specific records without the complexity of a managed archiving platform.

Is it safe to use a mass delete script in NetSuite?

Mass deletion in NetSuite is irreversible for most record types — once deleted, records cannot be recovered from within NetSuite. Before running any mass delete operation, export or back up the records you plan to delete, test in a sandbox environment first, and ensure the records have no dependencies that would prevent deletion.

Can the Mass Delete Tool handle large record volumes in NetSuite?

Yes. The tool processes deletions in scheduled batches to avoid governance limit errors that occur when too many operations run in a single script execution. NetSuite's SuiteScript governance model limits API calls and database operations per execution, so batch processing with a scheduled script is the standard approach for large-volume operations.

What NetSuite permissions are required to run a mass delete script?

Running a SuiteScript-based mass delete tool typically requires Administrator access or a role with full permissions on the targeted record type, plus permission to deploy and execute SuiteScripts. The specific permissions depend on which record types you are deleting and how the script is deployed in your NetSuite account.