I’m writing this for a colleague, but figured it wouldn’t hurt to put it somewhere where I can find it again for myself!
Start here. This is another post that describes how to set up a custom record type called “Consignment Inventory.” Here’s what you get from that.
Now, let’s create some SuiteScipt server-side code to read that custom record type using a filter expression. It should be pretty self-explanatory.
Here is a link to a SuiteAnswers article that includes all the SuiteScript 1.0 filter operators.
https://netsuite.custhelp.com/app/answers/detail/a_id/10565/kw/filter%20expression/related/1
And here is the code that you can paste into your project.
var my_namespace = {
useFilterExpression: function() {
var filterExpression = [
[
[‘custrecord_logic_consign_lead_time’, ‘greaterthan’, 0]
, ‘and’,
[‘custrecord_logic_consign_lead_time’, ‘notgreaterthan’, 14]
]
];
var columns =new Array();
columns[0] = new nlobjSearchColumn(‘custrecord_logic_consignment_item’);
columns[2] = new nlobjSearchColumn(‘custrecord_logic_consign_lead_time’);
columns[2].setSort(false);
var searchResults = nlapiSearchRecord(‘customrecord_logic_consignment_inventory’, null, filterExpression, columns);
var result =new Array();
if (searchResults) {
for (var i =0; i < searchResults.length; i++) {
result.push(
{
‘item’ : searchResults[i].getValue(‘custrecord_logic_consignment_item’)
, ‘leadtime’ : searchResults[i].getValue(‘custrecord_logic_consign_lead_time’)
}
);
}
}
}
};