Learn how to create a mass update script to delete records

Introduction

NetSuite has a script type called “Mass Update”.  The script allows the user to execute custom logic on each record in the search.  NetSuite gives you 1000 governance points for each record in the search.  This gives you plenty of governance to do what you need to do on a per record basis.  In this article I will demonstrate how to create, deploy, and run a mass update script to delete records.

Step 1: Upload the following script to the SuiteScripts folder

 

/**
 *@NApiVersion 2.1
 *@NScriptType MassUpdateScript
 */
 define(['N/record'], (record) => {
    function each(params) {
        record.delete({type: params.type,id: params.id});
    }
    return {
        each: each
    };
});

Step 2: Create the Script record

  1. Go to Customization->Scripting->Scripts->New.
  2. Enter a name for the script “Delete Mass Update”.
  3. Click Save.
  4. Click “Deploy Script”.
  5. Select the record type you want to delete under “Applies To”.
  6. Select the roles you want to be able to execute this mass update script or check the “Select All” checkbox.
  7. You can leave the status as “Testing” but don’t forget to come back and set to “Released” so other users can run the mass update.
  8. Select “Execute As Role” to Administrator.
  9. Click Save.

Step 3: Execute the mass update script

  1. Go to Lists->Mass Update->Mass Updates
  2. Open “Custom Updates” and you will see the record type you chose and then the name of your mass update.  See below:

 

 

  1. Click on the link for the mass update, “Delete Mass Update” in this case.
  2. Select your criteria then click “Preview”:

 

 

  1. Verify the results and uncheck “Apply” for the records you want to exclude from being deleted.
  2. Finally, click “Perform Update” which will delete the records (be carefull as this operation is permanent):

 

 

  1. For a large update you may need to keep clicking “Refresh” to see how many records have been deleted.  Once NetSuite has finished executing the script against all records you will see this:

 

Conclusion

The mass update script type is useful for executing custom logic against a search result. Do you need help building a Mass Update script for NetSuite? Please contact us here to set up a consultation.

Follow on
Jaime Requena Chief Executive Officer

Jaime Requena is a seasoned NetSuite Consultant and Solutions Architect, known for delivering WHITE GLOVE service to businesses. With 15+ years of experience and 3x certifications in ERP, Developer, and Admin, Jaime specializes in highly customized NetSuite accounts, transforming operations for 200+ satisfied customers all across the globe.

Get Connected

How can we help?


    Stay in the loop with Suite Tooth Consulting!

    We aim to bring unmatched expertise and professionalism to your NetSuite initiatives. Let’s talk about how our NetSuite consultancy can make a difference!

    Global Client Satisfaction

    Client Testimonials

    It’s Been 4+ Years Now And We Have Worked With Hundreds Of Clients, Building Our Way To The Top, One Happy Client After Another! Their Voices Of Satisfaction Serve As A Testament To Our Success –