ANS-0193 · SAVED SEARCHES & FORMULAS

How to Retrieve the Transaction Internal ID from a Line Item in NetSuite

Learn methods to accurately obtain the parent transaction's internal ID when working with line-level data in NetSuite saved searches or custom fields.

Short answer

To retrieve the transaction's internal ID from a line item, use {id} in a transaction column. Alternatively, source the transaction's internal ID into a custom body field. If a line-level identifier is unexpectedly concatenated (e.g., '1925_1'), use string manipulation functions like SUBSTR and INSTR to extract the transaction ID.

Scenario

Users often need to access the internal ID of the main transaction record (e.g., a Purchase Order) when working with line-level details, such as in a saved search displaying individual line items. Directly referencing the transaction ID from a line item context can sometimes be challenging, especially if line-level identifiers are formatted differently.

Solution

To retrieve the internal ID of the main transaction record (e.g., a Purchase Order) from a line-item context, the {id} field in a transaction column typically provides the transaction's internal ID directly.However, if a line-level identifier were to present a concatenated string that includes both the transaction ID and the line number (for example, '1925_1'), string manipulation would be necessary to extract only the transaction ID. In such a scenario, the following formula could be used:

SUBSTR({id},0,INSTR({id},'_')-1)

This formula extracts the substring from the beginning of the {id} field up to the character just before the first underscore, effectively isolating the transaction ID.An alternative method involves sourcing the transaction's internal ID into a custom body field on the transaction record. Once the custom body field is populated with the {id} value, its content can then be referenced in any column where the transaction ID is required, simplifying access without complex string functions.

Expert NetSuite Support

Need help with this NetSuite issue?

Saved Searches & Formulas consulting and configuration support

Talk to a consultant