The Mass Update script may be one of the most time-saving scripts. Imagine making a small change to all of your inventory items one at a time. You would probably come close to quitting your job! Here is some information to help you get started with Mass Update scripts.

How It Works

A mass update script runs on a specified list of records and performs the same action to each of those records.

Creating and Setting Up

Using this sample code, here is how to set up a mass update that populates the department field on each line item of a PO with the department on the main section of the PO. I won’t go into the mechanics of the code, but I have included comments in the code so that anyone can follow along.

 *@NApiVersion 2.0
 *@NScriptType MassUpdateScript
 function (record) {
 function each(params) {
  // Need to LOAD each record and SAVE it for changes to take effect
  // LOAD the PO
  var poRec = record.load({
    type: params.type,

  // get the department that's on the main body of the PO
  var mainDepartment = poRec.getValue('department');

  // get a count of the line items
  var lineCount = poRec.getLineCount({
    sublistId: 'item'

  // go through each of the line items and set the department to the main level department
  for (var i = 0; i < lineCount; i++) {
    sublistId: 'item',
    fieldId: 'department',
    line: i,
    value: mainDepartment

  // SAVE the PO;
 return {
  each: each
  1. NAVIGATE to Customization > Scripting > Scripts > New
  2. UPLOAD your mass update javascript file and CLICK the “Create Script Record” button
  3. NAME your mass update. Example: “Update PO Line Department”
  4. CLICK on the “Deployments” subtab and ADD Purchase Order deployment under “Applies To”
  5. Leaving the “Status” as “Testing” will permit only you to run the Mass Update. Changing it to “Released” will make it available to everyone in your organization
  6. CLICK on the “Save” button to save the mass update script record

Running the Mass Update

  1. NAVIGATE to Lists > Mass Update > Mass Updates
  2. Under “Custom Updates” > “Purchase Order” CLICK on your newly created Mass Update. You are basically creating a saved search on which to run your Mass Update.
  3. NAME your mass update search in “Title of Action”
  4. Here you can specify criteria for which Purchase Orders you are updating. Do nothing to run the update on all Purchase Orders.
  5. CLICK on the “Save” button to save the search for your mass update.
  6. NAVIGATE to Lists > Mass Update > Saved Mass Updates and search for your saved Mass Update search.
  7. CLICK “preview” to see a list of the records that will be affected.
  8. CLICK the “Perform Update” button to begin running the update.

Example Uses

  • Calculating a new item sales price on all inventory items
  • Updating the subsidiaries on all vendors
  • Change the naming convention of all records by adding a prefix to the existing name


Mass Updates have been life-saving for me and have saved tons of time doing manual entry. I would love to hear from you if need help getting started with Mass Updates!

For more scripting overviews, check out our blog covering some of the major script types. After learning about these various script types, you will be prepared to jump into our mini tutorial series on the basics of coding in SuiteScript 2.0. And don’t forget to subscribe to our mailing list so you can receive our latest developing blogs directly in your inbox each week!