Discussions
Suitescript 1.0 nlobjSearchFilter issue on field containing object
My suitescript 1.0 script is using a search filter to return a transaction recordset. I'm trying to search on the 'createdfrom' field for the value 'Sales Order #ORD165365', but the filter has no effect (I think) because this field is actually an object. If I view the output from my RESTlet, I see the following structure:
[createdfrom] => stdClass Object
(
[name] => Sales Order #ORD165365
[internalid] => 9125879
)
Using the above, I would need to search createdfrom[name] but I'm not sure if this possible. Any ideas? Here is my code:
function getRESTlet(dataIn) {
var data = {};
var filters = new Array();
var order = dataIn[0]['order'];
var shipping_postcode = dataIn[0]['shipping_postcode'];
var c = 0;
filters[0] = new nlobjSearchFilter('createdfrom', null, 'anyof', 'Sales Order #ORD165365');
var columns = new Array();
columns[0] = new nlobjSearchColumn('custbody_nbs214_email');
columns[1] = new nlobjSearchColumn('internalid');
columns[2] = new nlobjSearchColumn('createdfrom');
var savedSearch = nlapiCreateSearch('transaction', filters, columns);
var resultset = savedSearch.runSearch();
var returnSearchResults = [];
var searchid = 0;
do {
var resultslice = resultset.getResults(searchid, searchid + 1000);
for ( var rs in resultslice) {
returnSearchResults.push(resultslice[rs]);