Netsuite Suitescript API - 搜索事务记录返回重复项 [英] Netsuite Suitescript API - Searching Transaction records returns duplicates

查看:86
本文介绍了Netsuite Suitescript API - 搜索事务记录返回重复项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对交易记录进行基本搜索查询(我也尝试使用'salesorder'来获得类似的结果)。查询没有过滤器,只请求internalid作为搜索列,但由于某种原因,结果包含多次相同的记录...有时多次。

  [
{
internalid:1984
},
{
internalid:1984
},
{
internalid:1984
},
{
internalid:1998
},
{
internalid:1998
},
{
internalid:1998
},
{
internalid:2490
},
{
internalid:2490
},
{
internalid: 2573
},
{
internalid:2573
},
{
internalid:2491
},

为什么会发生这种情况?有没有办法让查询只返回一次记录?



编辑:按要求添加代码

  var filters = []; 
var columns = [];
columns.push(new nlobjSearchColumn('internalid'));

var searchResults = nlapiSearchRecord('transaction',null,filters,columns);

返回searchResults;


解决方案

请添加过滤器,


主线为TRUE


如果您通过代码使用已保存的搜索,请添加额外的过滤器



as new nlobjSearchFilter('mainline',null,'is','T') ['主线','是','T']



搜索结果拉出相同的内部ID,所有订单项的多次


编辑:对于提供的代码示例




  var columns = []; 
columns.push(new nlobjSearchColumn('internalid'));

var searchResults = nlapiSearchRecord('transaction',null,['mainline','is','T'],columns);

返回searchResults;


I am attempting a basic search query of the 'transaction' records (I have also attempted this with 'salesorder' with similar results). The query has no filters, and requests only the internalid as a search column, but for some reason the results include the same record multiple times... sometimes MANY times.

[
  {
    "internalid": "1984"
  },
  {
    "internalid": "1984"
  },
  {
    "internalid": "1984"
  },
  {
    "internalid": "1998"
  },
  {
    "internalid": "1998"
  },
  {
    "internalid": "1998"
  },
  {
    "internalid": "2490"
  },
  {
    "internalid": "2490"
  },
  {
    "internalid": "2573"
  },
  {
    "internalid": "2573"
  },
  {
    "internalid": "2491"
  },

Why would this happen? Is there any way to get the query to only return each record once?

EDIT: Adding code as requested

var filters = [];
var columns = [];
columns.push(new nlobjSearchColumn('internalid'));

var searchResults = nlapiSearchRecord('transaction', null, filters, columns);   

return searchResults;   

解决方案

Please add a filter,

mainline is TRUE

If you are using saved search via code, please add additional filter

as new nlobjSearchFilter('mainline', null, 'is', 'T') or ['mainline', 'is', 'T']

as the search result pull up the same internal id, multiple times for all line items

EDIT: For the provided code example

var columns = [];
columns.push(new nlobjSearchColumn('internalid'));

var searchResults = nlapiSearchRecord('transaction', null, ['mainline', 'is', 'T'], columns);   

return searchResults; 

这篇关于Netsuite Suitescript API - 搜索事务记录返回重复项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆