搜索中的列值 api

Column Value in search api

我想从销售订单记录的项目子列表中获取值。

但是无法获取。虽然我可以获得SO记录的实体字段的值。

下面是代码片段:

        var filters = new Array();
                        filters[0] = new nlobjSearchFilter("mainline",null,"is","T");

                        var column=new Array();
                        column[0] = new nlobjSearchColumn("trandate");
                        column[1] = new nlobjSearchColumn("item");
                        column[2] = new nlobjSearchColumn("cust_col_1");

                var result = nlapiSearchRecord('salesorder', null, filters, column);

    for(var i = 0; i<result.length; i++)
            {
                var col = result[i].getAllColumns();
                var date = result[i].getFieldValue("trandate"); //I get this
                var item_id =  result[i].getLineItemValue("item", "item", i+1); // I don't get this
                var cust_col = result[i].getLineItemValue("item", "cust_col_1", i+1); //I don't get this
            }

我想我定义的列有误。

通过指定过滤器 new nlobjSearchFilter("mainline",null,"is","T"),您基本上是在告诉搜索您不需要任何订单项数据。这意味着您将无法读取任何列数据,无论是自定义的还是其他的。

mainline 过滤器参数基本上有三个选项,'F' 表示您需要行项目详细信息。 'T' 表示您只需要 header 数据。不使用此过滤器将 return 一行用于 header 信息,一行用于交易中的每个行项目。

这部分

var item_id = result[i].getLineItemValue("item", "item", i+1); // I don't get this var cust_col = result[i].getLineItemValue("item", "cust_col_1", i+1); //I don't get this

也是错误的,如果你已经加载了记录,你就可以使用这种语法,但对于搜索结果,你只需要使用

result[i].getValue('cust_col_1")