Netsuite nlapiSearchRecord Expression filters not working
-
21-12-2019 - |
Question
Running into an issue with the nlapiSearchRecord() I can apply the nlobjSearchFilter() object to the searchRecord but I need an OR option and it seems that the only thing the searchFilter passes is AND. I saw this post "NetSuite And/Or Filter" which gave me the the correct information but I keep getting the following error.
Title SSS_INVALID_SRCH_FILTER_EXPR_OBJ_TYPE
Type System
Details filters
and I am not sure why, I tried to do a search for the Error title "SSS_INVAILD_SRCH_FILTER_EXPR_OBJ_TYPE" but google did not produce any helpful information.
Here is the Expression Code I am running
filterExpr = [
['internalid',null,'is',itemId],
'AND',
[
['inventorylocation',null,'is',locationId],
'OR',
['inventorylocation',null,'is',3]
]
];
var results = nlapiSearchRecord('item',null,filterExpr,columns);
--- SOLVED ---
Figured it out the issue was with the null I had in the filter it should have been written as such.
filterExpr = [
['internalid','is',itemId],
'AND',
[
['inventorylocation','is',locationId],
'OR',
['inventorylocation','is',3]
]
];
var results = nlapiSearchRecord('item',null,filterExpr,columns);
Thanks in advance for the help.
Solution
The filter did not need the null option that I was putting in my bad for not fully reviewing the format.
--- SOLVED ---
Figured it out the issue was with the null I had in the filter it should have been written as such.
filterExpr = [
['internalid', 'is', itemId],
'AND', [
['inventorylocation', 'is', locationId],
'OR', ['inventorylocation', 'is', 3]
]
];
var results = nlapiSearchRecord('item', null, filterExpr, columns);