The N/commerce/recordView module is a read-only SuiteScript 2.x module designed to retrieve data from SuiteCommerce-related records, such as:
Website records
Item records
Commerce category records
This module is used only for viewing these records — not for creating or updating them.
? Why and When Should You Use It?
? Use it when:
1- You need to fetch website data, like:
– Website internal ID
– Supported ship-to countries
– Other website-level settings
2- You want to retrieve item information, such as:
– Item names, display names
– Item availability
– Prices (depending on configuration)
3- You want fast, optimized access to category data in a SuiteCommerce context.
4- You’re building a Suitelet or backend integration that needs to show
5- webstore data on a custom dashboard, admin page, or third-party system.
? Example Use Case:
You’re building a Suitelet that shows selected item names and the current website’s ship-to countries for a SuiteCommerce site. Instead of creating custom searches or joins, you can use recordView.viewWebsite() and recordView.viewItems() for a clean, fast, and efficient solution.
? When NOT to Use It
You should not use N/commerce/recordView in the following cases:
1- When you want to create, edit, or delete records.
– This module is read-only. For full record operations, use N/record.
2- When working with non-commerce records, like:
Customers
Sales orders
Employees
Vendors
3- These are not supported by this module.
When you need advanced filtering or searching (e.g., conditions, sorting, joins).
– Use N/search for custom or complex data searches.
– recordView is limited to simple retrieval by ID.
4- If you’re not working in a SuiteCommerce environment.
– This module is built for SuiteCommerce or extensions that depend on SuiteCommerce data.
So, use recordView when you need quick and easy read access to SuiteCommerce-related data. But avoid it when you’re dealing with standard NetSuite records or need advanced operations.