我想从符合我标准的items子列表中获取custitem1的列表或tranid。
var filter = new Array();
filter[0] = new nlobjSearchFilter('mainline', null, 'is', 'T');
filter[1] = new nlobjSearchFilter('item.custitem1', null, 'is', 'myItems'); // this is not working
var column = new Array();
column[0] = new nlobjSearchColumn('tranid');
column[1] = new nlobjSearchColumn('createdfrom');
var fulFillSOInternalIDs = nlapiSearchRecord( 'itemfulfillment', null, filter, column);
答案 0 :(得分:1)
如果您的字段不支持使用“anyof”进行过滤,则需要使用表达式进行搜索。此外,如果要搜索子列表值,则需要将mainline设为false,因为mainline true仅返回body字段。以下是它的工作原理:
var columns = [];
columns.push(new nlobjSearchColumn("tranid"));
columns.push(new nlobjSearchColumn("createdfrom"));
var filters = [];
filters.push(["mainline", "is", "F"]);
filters.push("AND");
//PARENTHESIS START
//Looping through myItems array to create the expression
var parens = [];
for (var i in myItems){
parens.push(["item.custitem1", "is", myItems[i]]);
parens.push("OR");
}
parens.pop();//Remove the last OR
filters.push(parens);
//PARENTHESIS END
var transactionSearch = nlapiSearchRecord("itemfulfillment", null, filters, columns);
答案 1 :(得分:1)
你应该加入你的过滤器。将下面的过滤器插入@ adolfos'代码。
filter[1] = new nlobjSearchFilter('custitem1', 'item', 'is', 'myItems');