To change the prefix of a document number in NetSuite for both future and existing records, you can follow this structured and safe process:
Disable Advanced Numbering (if enabled)
- Navigate to: Setup > Company > Setup Tasks > Auto-Generated Numbers
- Uncheck the “Use Advanced Numbering” checkbox.
- Click Save.
Enable “Allow Override”
- Still in the Auto-Generated Numbers page:
- Check the “Allow Override” checkbox for the relevant transaction type (e.g., Invoice, Sales Order).
- This allows you to edit numbers manually or via script for existing records.
Update Existing Records
We have two options:
- Manual Update (for small volumes):
- Open each transaction.
- Change the document number manually to include the new prefix (e.g., from
INV123toNEW-INV123). - Map/Reduce Script (for bulk updates):
- Use a Map/Reduce script to safely bulk-update historical records. Here’s a brief logic flow:
record.submitFields({
type: record.Type.INVOICE,
id: invoiceId,
values: {
tranid: 'NEW-' + currentTranId
}
});
Revert “Allow Override” Setting
Once all historic transactions are updated:
- Go back to Auto-Generated Numbers
- Uncheck the “Allow Override” option for the transaction type.
- Click Save.
Re-enable Advanced Numbering (optional but recommended)
- Check the “Use Advanced Numbering” again.
- Click Edit next to the transaction type and configure:
- Prefix (e.g.,
NEW-) - Minimum digits
- Suffix or date-based components (if needed)
- Save the rule.