NetSuite - Mass Update to fix Adjustment Account

The Problem

We recently discovered that a client had imported tens-of-thousands of initial inventory adjustments without selecting an adjustment account. It had defaulted to a checking account, which obviously had a huge impact on their books. These kinds of issues can be common – setting the wrong account, date, memo, subsidiary, etc., during a bulk import (or forgetting to set something altogether that you later need).

Correcting these can be done through either a CSV import or through a Mass Update. I much prefer the latter, for a few reasons:

  • Greater visibility of the progress as records are fixed.
  • Error reporting that's actually helpful (errors from CSV imports can be absolutely generic; in some cases they can be outright wrong).
  • If needed, gives you the ability to query for additional data or relationships that you need in order to update your base record.
  • Building a search for the records that need correcting provides clarity into exactly what records you're trying to find and fix in the first place.

Building the Mass Update Script

The simplest example, as with the issue above, looks like this:

 * @NApiVersion 2.1
 * @NScriptType MassUpdateScript
define(["N/record"], function (record) {
  return {
    each: async function (params) {
      try {
        const ia = record.load(params);
          fieldId: "account",
          value: "550", // 5952 Inventory Quantity Adjustments
      } catch (err) {
        log.error("err", err);

To get the account ID you can head over to the chart of accounts page and find the ID of the account you want to assign your records to (search for "page: chart" to get there quickly).

Throw this in a .js file and upload it to the file cabinet – e.g. SuiteScripts/MassUpdate/InvAdjSetPreferredAccount.js – add a Mass Update script referencing this file, and have fun.

The specifics of setting up a new script, referencing a .js file, configuring the script runtime properties, etc., are outside of the scope of this post, but if you have questions feel free to drop a line in the comments.

We've used mass updates to fix imported data that had issues, to add fields we wished we'd added in the first place (like a memo or a custom field), and probably numerous other things. Hopefully this helps someone who's stumbling along and finds their way from a search engine. Cheers.