ANS-1661 · CUSTOM FIELDS, RECORDS & FORMS

NetSuite Workflow: Correctly Setting a Custom List/Record Field to the Current Record’s Internal ID

This guide explains how to resolve errors when using workflows to set a custom list/record field to the internal ID of the current transaction, particularly for sales orders.

Short answer

When configuring a NetSuite workflow to set a custom list/record field to the internal ID of the current record, use the field ID `{id}`. Unlike `{tranid}` or `{internalid}`, which can cause errors due to data type mismatches or formatting issues, `{id}` reliably references the record's internal ID for list/record field population.

Scenario

A custom list/record field is designed to link all Order to Cash transactions (Sales Order, Customer Deposit, Item Fulfillment, Invoice, Deposit Application, Payment, and Credit Memo) to the originating Sales Order. This field is used for sublists on Sales Orders and Invoices, as well as for reporting. For filtering purposes, the Sales Order itself must have its own internal ID set in this custom field. Attempts to set this field using `{tranid}` or `{internalid}` within a workflow result in errors.

Solution

When attempting to set a custom list/record field to the internal ID of the current record within a NetSuite workflow, the following considerations apply:

  1. Using {tranid} (document number/transaction ID) is not suitable if the document numbers contain leading zeros, as these zeros are often dropped when treated as a number, leading to an invalid value. Attempting to use TO_CHAR with {tranid} also results in an error due to an incorrect data type for a list/record field.

  2. The field ID {internalid} also returns errors when used to reference the record itself in a workflow context for populating a list/record field.

  3. To correctly set the custom list/record field to the internal ID of the current record (e.g., a Sales Order referencing itself), the correct field ID to use in the workflow is:

{id}

Using {id} successfully populates the custom list/record field with the current record's internal ID.

Expert NetSuite Support

Need help with this NetSuite issue?

Custom Fields, Records & Forms consulting and configuration support

Talk to a consultant