I am trying to create a NetSuite saved search that searches for a certain Item Fulfillment and bring back the items (with internal id of the items) on it This is the search I made ( both code and UI shown)
var transactionSearchObj = search.create({
type: "transaction",
filters:
[
["internalid","anyof","3296363"],
"AND",
["mainline","is","F"]
],
columns:
[
search.createColumn({name: "mainline", label: "*"}),
search.createColumn({name: "type", label: "Type"}),
search.createColumn({name: "tranid", label: "Document Number"}),
search.createColumn({name: "entity", label: "Name"}),
search.createColumn({name: "account", label: "Account"}),
search.createColumn({name: "amount", label: "Amount"}),
search.createColumn({name: "item", label: "Item"}),
search.createColumn({name: "quantity", label: "Quantity"}),
search.createColumn({
name: "internalid",
join: "item",
label: "Internal ID"
})
]
});
var searchResultCount = transactionSearchObj.runPaged().count;
log.debug("transactionSearchObj result count",searchResultCount);
transactionSearchObj.run().each(function(result){
// .run().each has a limit of 4,000 results
return true;
});
The issue is, it brings back multiple results for each item on the IF. I tried to change it to Mainline = true and that of course only brings back one line (the first item). I wondered if there is some other kind of filter that I would need to set to allow me to only bring back the results that would pertain to the lines as they are on the item fulfillment. Below is a screen shot to show the behavior as I am seeing it now.
Notice the duplicates (note i used the chrome addon to convert a saved search into code to get the below result and code. In the end I will be putting it into javascript code but i can convert it to script if I had the saved search working correctly.
You are getting a line per gl entry. You should single things up by adding
,"AND",
["cogs","is","F"]