ANS-0904 · SUITESCRIPT DEVELOPMENT

How to Control NetSuite Auto-Generated Transaction Numbers with Scripting?

This guide explains how to manage transaction ID generation using scripts and form customizations, ensuring data integrity and preventing unauthorized changes.

Short answer

To control auto-generated transaction numbers, enable 'Allow Override' for the transaction ID field and use a script to set the tranid only on CREATE events. Further secure this by setting the tranid field display type to 'INLINE TEXT' on the form and restricting 'Custom Transaction Form' permissions for relevant user roles.

Scenario

Users often need precise control over NetSuite's auto-generated transaction numbers, such as tranid, to maintain specific numbering conventions or integrate with external systems. The challenge arises when needing to override the default auto-generation while preventing unauthorized manual changes by users.

Solution

NetSuite's configuration API provides access to various preference categories:

General Preference

Company Information

Accounting Preference

Accounting periods

Tax Setup

User Preferences

Manufacturing Preferences

Tax Periods

To implement control over auto-generated transaction numbers, follow these steps:nn

  1. Ensure the 'Allow Override' setting for the transaction ID field is set to "true". Implement a script to set the "tranid" value exclusively during the CREATE event.nn

  2. Navigate to the form customization settings for the relevant transaction form and set the "tranid" field's display type to 'INLINE TEXT'.nn

  3. To prevent unauthorized modifications, remove the "Custom Transaction Form" permission or setup from the relevant user role configurations. This ensures users with that role cannot alter the form settings.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant