When you're working with SuiteScript, you may run into situations where you are running a transaction search for records and need to load those records, but don't know the type of each specific record. The code blocks included below are useful if you are processing multiple types of transactions, and you need the specific record.Type for each type of transaction that you are working on.
Below is an example:
3. Add the record type as a search column, as such below:
4. When loading each record, use result.getValue(“type”) with your transaction mapping to get the correct record.Type loaded.
This is how it would look:
That's it! You now have a unified approach to dynamically load multiple transaction types in SuiteScript—whether you're working with Sales Orders, Invoices, or any other record in NetSuite. By abstracting the record-loading step into a reusable function, you cut down on repetitive code and simplify future enhancements. Next time you need to support a new transaction type or adjust your logic, your script is already structured to handle it. Happy scripting!
We like to update our blogs and articles to make sure they help resolve any troubleshooting difficulties you are having. Sometimes, there is a related feature to enable or a field to fill out that we miss during the instructions. If this article didn't resolve the issue, please use the chat and let us know so that we can update this article!
Tagged with Training