Sunday, June 2, 2019

Sublist View data used in Script

NetSuite offers a "Customize View" feature on each sublist. This allows users to show data in they want to see in a way they want to see. This feature can be also used in SuiteScript.

One of the options is to create a saved search which will be generic (e.g. for all items) and than using this search in script where internal ID of record can be specified as additional filter.

Example:
On Item record there is a custom view which shows Bin Number, Inventory Number, On Hand count and Available.
To make it available in SuiteScript it is needed:
1. Create Saved Search to make the data available
2. Create script which processes the data

Note: For detailed information please check Defining a Saved Search

Creating Saved Search:
1. Create a saved search for Item
2. As Results use:
Inventory Number/Bin on Hand : Bin Number,
Inventory Number/Bin on Hand : Inventory Number,
Inventory Number/Bin on Hand : On Hand,
Inventory Number/Bin on Hand : Available

Creating script which processes the data:
Here the search is used with additional filter which specifies the internal ID of record:

var filterID = new nlobjSearchFilter('internalid',null,'is',7);var result = nlapiSearchRecord('lotnumberedinventoryitem','customsearch_peveprek_testing_view');
Processing the search result is generic and described e.g. in Executing Existing Saved Searches.

No comments:

Post a Comment