问题
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