Netsuite Suitescript API - Searching Transaction records returns duplicates

僤鯓⒐⒋嵵緔 提交于 2019-11-28 09:49:15

问题


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;   

回答1:


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; 


来源:https://stackoverflow.com/questions/33443264/netsuite-suitescript-api-searching-transaction-records-returns-duplicates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!