How to Set External IDs on Existing Departments With a CSV in NetSuite

Give existing departments a code from another system with one CSV update. Export the list with Internal ID, import it as Classification and Department with Data Handling set to Update, and check the result.

The quick answer

Export the Departments list with its Internal ID column, then build a two-column CSV with Internal ID and External ID. Go to Setup > Import/Export > Import CSV Records, set Import Type to Classification and Record Type to Department, and upload the file. Set Data Handling to Update. On Field Mapping, check that Internal ID goes to Department : Internal ID and External ID goes to Department : External ID. Run the import, then reopen the Departments list. Internal ID is the key because the departments have no External ID yet, so there is nothing else to match on.

The screenshots show sample data. Person and company names are fictional. Use your own departments and codes when you follow the steps.

Before you start

You need a role that can run CSV imports, see the import status, and edit departments, with access to the departments you're changing. Menu paths are the ones in this account. If one isn't where it says, search for its name in global search.

This example gives three departments a payroll code so a later import can refer to a department as PAY-210 instead of by its name. A few things decide whether the update works:

  • The file has to carry Internal ID, so the list you export has to show it. If your Departments list doesn't, add the column in Edit View or turn on Show Internal IDs under Home > Set Preferences, then check the column appears before you export. Internal IDs belong to one account, so don't reuse a file exported from a sandbox.
  • A department has one External ID, and a code can't repeat one that another record in the same group already uses. If several systems each need their own code for a department, the extra codes belong in custom fields.
  • Update changes existing departments and doesn't create new ones. It's the right choice here because all four departments already exist.
  • Departments left out of the file aren't targeted by this import, so they keep whatever they have now.

01. Check the departments and their Internal IDs

Go to Setup > Company > Departments. This account uses the Custom Department Default view, which shows Internal ID, Name and External ID. Customer Service is 6, Dispatch is 3, Fleet Maintenance is 4 and Warehouse is 7. The External ID column is empty for all four.

Four departments with Internal IDs 3, 4, 6 and 7, and no External IDs.

02. Export the list to CSV

Click the CSV export icon above the list. NetSuite downloads the list with the columns in your view, including Internal ID. That file is a starting point, not an import template, so you'll trim it in the next step.

The CSV icon is the first of the four icons above the list.

03. Prepare the update file

Open the export in a spreadsheet. Delete the Name column, so the import can't rename anything by accident. Enter the codes in the External ID column: PAY-210 for Internal ID 3, PAY-220 for 4 and PAY-230 for 6. Delete the Warehouse row (7), because it has no payroll code yet and shouldn't change. Check that the spreadsheet kept the codes exactly as typed, then save the sheet as a comma-delimited CSV named departments-external-ids.csv.

The finished file has two columns and three data rows. The screenshot is the saved file.

The update file: Internal ID 3, 4 and 6 with PAY-210, PAY-220 and PAY-230. No Name column, and no row for Warehouse.

04. Start a Department import

Go to Setup > Import/Export > Import CSV Records. Departments are imported under Classification, so set Import Type to Classification and Record Type to Department. Leave Character Encoding and CSV column delimiter alone unless your file needs something else. Under CSV File(s), click Select..., choose departments-external-ids.csv, and click Next.

In this account the Classification type lists Activity Code, Class, Department and Location.

Import Type Classification, Record Type Department, and the chosen file.

05. Set Data Handling to Update

On Import Options, set Data Handling to Update and click Next. The departments already exist, so each row should change one instead of adding another. Leave Advanced Options as they are for this update.

Data Handling is Update. Add and Add or Update sit above and below it.

06. Check the field mapping

On Field Mapping, NetSuite has matched both columns. Check each one instead of trusting the proposal. External ID goes to Department : External ID, which is the value being written. Internal ID goes to Department : Internal ID, which tells NetSuite which department each row changes. If either row is missing, map it before you continue. If your account marks any other field as required, map that too. Click Next.

Both columns are mapped: External ID to Department : External ID, Internal ID to Department : Internal ID.

07. Run the import and check the job

On Save mapping & Start Import, you can leave Import Map Name blank. A saved mapping is optional, and you only need one if you'll run the same update again. Open the Save & Run menu and choose Run. If NetSuite asks you to confirm running an import that isn't saved, confirm it.

Import Map Name stays blank. The Save & Run button has a menu with Run.

NetSuite says the Department import job is in process. Click Import Job Status in the confirmation, or go to Setup > Import/Export > View CSV Import Status. The job shows Complete, 100.0%, and 3 of 3 records imported successfully, one for each data row in the file. The successful count should equal the number of data rows. If it's lower, open CSV Response to see which rows failed and why. A finished job doesn't prove the values landed, so check the list next.

Status Complete, 3 of 3 records imported successfully.

08. Confirm the External IDs

Go back to Setup > Company > Departments. Dispatch shows PAY-210, Fleet Maintenance shows PAY-220 and Customer Service shows PAY-230. The names and Internal IDs haven't changed. Warehouse still has no External ID, because its row wasn't in the file.

The Departments list after the update: three departments have payroll codes, and Warehouse is still blank.

Check the result

  1. Job Status shows Complete, and the successful count equals the three data rows in the file (3 of 3 here).
  2. Dispatch (3) shows PAY-210, Fleet Maintenance (4) shows PAY-220, and Customer Service (6) shows PAY-230.
  3. Names and Internal IDs are unchanged, and Warehouse (7) still has a blank External ID.

Common questions

Why use Internal ID instead of External ID to match the rows?

The file writes a new External ID, and these departments don't have one yet, so there is nothing to match on. Internal ID is assigned by NetSuite and doesn't change, so it identifies each existing department. External ID can only work as the key for records that already have one.

What does Update do with a row that doesn't match a department?

With Update, NetSuite doesn't create a department for a row that doesn't match, so that row fails. Check the Internal IDs before you run the import. This walkthrough only imports rows that match, so it doesn't show a failed row. If the job reports fewer rows than the file has, open CSV Response to see which row failed and why.

Do I have to delete the Name column?

If you're only setting External IDs, delete it. A Name column left in the file and mapped could rename a department by accident, so the file here keeps only Internal ID and External ID and each row does one thing. Make sure no old or blank External ID column is left in the file either.

What happens to departments that aren't in the file?

This import doesn't target them. Warehouse isn't in the CSV, so it keeps its blank External ID.

Do I have to save the import mapping?

No. The Import Map Name is optional, and this run leaves it blank. Save one if you'll run the same update again with a file that has the same columns.

Can I set External IDs on classes or locations the same way?

Classes and locations sit under the same Classification import type as departments, so you'd pick a different Record Type and follow the same pattern. This walkthrough only runs it on departments, and doesn't cover subsidiaries.