GUIDES · NETSUITE · ACCOUNTS PAYABLE
How to code NetSuite bills to departments, classes and locations with AI, using a saved search and CSV import
NetSuite lets you set a class, department, location or custom segment on a whole vendor bill or on each expense line. Getting the right combination on every line is the hard part: the same vendor bills for three departments, the memo says "annual renewal", and the class depends on a project the AP clerk has never heard of. This guide shows how to code those lines with a model trained on the bills your team has already coded and approved, using three things you already have: a saved search, a spreadsheet and NetSuite's CSV import.
What you need
- NetSuite with permission to create saved searches and run CSV imports for vendor bills.
- A StayCharted account. The Review Queue is on Essentials and Business.
- A sandbox account, if you have one, for the first import.
About 7 minutes to read. The import instructions follow Oracle documentation; this workflow has not been tested end to end in a NetSuite account. Have your NetSuite administrator verify the saved-search line identifier, import key and approval behavior in a sandbox before updating live bills.
Step 1. Export lines your team has already coded
Create a transaction saved search:
- Criteria: Type is Vendor Bill; Main Line is false (so each expense line is a row); Date within the last 12 to 24 months; and, if you use approvals, only approved bills.
- Columns: the bill's Internal ID, the line's ID, Vendor, Memo (the line's), Amount, Account, Department, Class, Location, and any custom segments you code.
Export it as CSV. Each row is a line someone on your team coded, which is exactly what the model learns from.
Main Line is false also exposes other transaction lines. Restrict this export to the expense lines you intend to update, exclude tax or other generated lines, and check that each bill-and-line key is unique. Ask your NetSuite administrator to verify which saved-search identifier maps to the Expenses import key; do not substitute a spreadsheet row number.
Step 2. Train a model on it
In StayCharted, start a new model and upload the file.
- The model reads: Vendor, Memo, Amount, and anything else your team looks at when coding a line.
- The answer: choose Account, Department, Class and Location as answer columns together. The model learns them as one answer, so it never suggests a combination your team hasn't used.
- Leave out: the Internal ID and line ID. They identify the line; they don't help code it.
StayCharted checks the file first (the same memo coded two ways, combinations with too few lines), then trains and tests the model on lines it never saw. Read the report: how often each combination is right, which ones it confuses, and what share of lines are right above each confidence. Pick the cutoff where the lines above it are right often enough to go straight through.
Use consistent names or IDs for accounts and segments, and resolve blank answer fields before training. Confidence is not a guarantee: check a sample of the higher-confidence answers too.
Step 3. Export the lines that need coding
Copy the saved search and change the criteria to the bills waiting to be coded, for example Department is empty, or a status your AP process uses. Keep the Internal ID and line ID columns: the import needs them to find each line again. Export as CSV.
Step 4. Fill the file
In StayCharted, open the model's Use tab and fill the file. Every row gets the suggested account, department, class and location, a confidence, and whether it needs review. Your other columns stay as they were.
Fill only the answer cells that need coding. Keep the bill and line identifiers unchanged, and preserve existing valid coding. Use the same input columns and format as the training file.
Step 5. Review the unsure lines
Lines below your cutoff are flagged in the file and wait in the Review Queue on Essentials and Business. A reviewer confirms or corrects each one. Their answers become training examples for the next version, so the next version can learn from the corrections.
Before import, reconcile approved corrections into the CSV you will upload. Do not assume an earlier downloaded file updates itself. Retrain and publish the model before expecting corrections to affect later fills.
Step 6. Import the coding back into NetSuite
Oracle’s documented way to change existing bills is a mass update: a transaction saved search of vendor bills, the data changed outside NetSuite, then the Import Assistant with the Update data handling option.
- Import type: Transactions, Vendor Bill, Update.
- Expenses in their own file. NetSuite asks for expense lines in a separate CSV file from the bill itself.
- Match each bill by its Internal ID, on every row.
- Match each line by its line key. The Expenses sublist can be updated line by line.
- Map Department, Class, Location, custom segments and, if you're changing it, Account, onto the expense lines.
Run the first import in a sandbox, or on a handful of bills, and check them before importing the rest. Save the import map to reuse each week.
Map coding fields to the Expenses sublist, not the bill header. Verify the Line/Order Line key mapping with your administrator. Keep Overwrite Sublists off for selective updates, and confirm that untouched expense lines remain unchanged in your sandbox test. Use account and segment values accepted by your import map, and include only the records and fields you intend to update.
Coding bills before they're entered
If your bills arrive as a spreadsheet, from a capture tool or a supplier portal, you can fill that file before importing the bills as new records. The coding is then on each line from the start, and you replace Steps 3 and 6 with a new-record import using NetSuite's required fields and IDs. Review the coding before creating bills.
Keeping it accurate
- Retrain monthly or quarterly on the newest coded lines, including the reviewers' answers.
- After a chart of accounts or segment change, retrain on lines coded the new way. A model only suggests combinations it has seen.
- Watch the report per combination, not just the overall figure. A new cost center starts with no examples.
Oracle references
Common questions
Can AI code NetSuite bill lines to departments and classes?
Yes. A model trained on lines your team has already coded suggests the department, class, location and account for new lines, with a confidence. You import the coding back with NetSuite's CSV import.
Do I need to install a SuiteApp?
No. This uses a saved search export, a fill in StayCharted and NetSuite's own CSV import. Nothing connects to your NetSuite account.
Can it code custom segments?
Yes. Add the custom segment as one of the answer columns, as long as your coded lines have it filled.
How many coded lines do I need?
A few hundred to start, with at least about 20 for each combination you want suggested, and more for combinations that look alike.
Can NetSuite's CSV import update lines on existing bills?
Yes. Oracle documents updating existing vendor bills with the Import Assistant's Update option, with expense lines in a separate file and each bill matched by its internal or external ID.
Does this work for expense reports or journal entries?
Training and filling can be reused, but import behavior differs by transaction. Check Oracle’s rules before applying it: journal-entry Update imports can append lines rather than replace them. Do not reuse a vendor-bill import map for journals.
Put it into practice
QuickBooks to NetSuite migration →
Automate GL coding in accounts payable →
NetSuite is a trademark of Oracle. StayCharted is not affiliated with Oracle.