How to avoid Duplicate Document Numbers for Invoice created through netsuite RESTAPI

28 Views Asked by At

I'm using Netsuite REST APIs to create invoices. The invoice document numbers (tranid) are auto-generated using Netsuite setup. All my APIs are implemented in AWS Lambda functions, which are configured with a concurrency of 2 (this cannot be modified). However, this concurrency setting sometimes causes two records to be triggered at the same time, resulting in duplicate document numbers in Netsuite.

How can I avoid these duplicate number issues programmatically?

To address this issue, I've configured Warn and Block for duplicate number warnings at the account level. While this feature works at the UI level, it doesn't prevent duplicate numbers in scripts. How can I avoid these duplicate number issues programmatically?

1

There are 1 best solutions below

0
RGArun On

Following answer i had received from oracle support.

The behaviour you are reporting tends to happen when the transaction ID is generated already during record generation (loading transaction), so the way to go about this is to apply settings that will generate the transaction ID only upon saving the transaction.

Option #1:

Set "Generate Document Number on Save" field value to "true" on the form used within the record creation (either the preferred record form, or the form specified within your script).

For discussion on steps to do this, see the following SuiteAnswers article: Explain Why Order # Field Shows 'To be Generated' Even When Auto-generated Number Allow Override is Enabled Answer ID 103028

For discussion of the impact of the modification: Generate Tran ID on Save Answer ID 62197

Option #2:

During the programmatic record creation via Rest API, set the field “generatetranidonsave” to “true”. I am aware this field is not documented, but it is well worth trying to set it via the JSON payload.

Given solution is working perfectly.