I've only worked with NetSuite and SuiteTalk for less than one year. I've found examples of basic searches and advanced searches that leverage saved searches, but I had a hard time finding examples of how to perform an advanced search from scratch with criteria and selected columns in the result set. So I'm asking for examples.
相关问题
- How to remove duplicate elements in a array using
- How go I get csv data into netsuite?
- SuiteScript 2.0 Add filters to saved search in scr
- NetSuite And/Or Filter
- Net Suite getting all records
相关文章
- Reach a NetSuite RESTlet via OAuth
- In NetSuite with SuiteScript 2.0 unable to send a
- Set Authorization/Content-Type headers when call H
- NetSuite saved search formula to multiply results
- Netsuite Advanced PDF/HTML code ifelse statement
- Get Items in a PurchaseOrder using SuiteTalk
- NetSuite SuiteTalk REST Web Services - Invalid Log
- Has anyone been able to get the suds soap library
I came back to this code a year later. I was coding another advanced search and thought perhaps it was unnecessary to add a blank element to the array definitions. THAT WAS A MISTAKE. It is absolutely necessary! If you omit these, the search works, but returns nothing but nulls for SearchResult.basic and SearchResult.ItemJoin.
I reviewed examples provided in the NSClientERP project downloadable from NetSuite. Here is a simplified example.
It is important to set your search preferences prior to performing your advanced search. Without setting returnSearchFields to true, I got no results. Also, you must supply both criteria and columns. In the NSClientERP example, each object starting with the TransactionSearchAdvanced was instantiated, configured and linked to child objects in separate lines of code. I found this very hard to follow. I'm using one line of code that instantiates the entire search object.
Another thing to note is the itemJoin, which joins the Items table to a sales order line item. There are other joins available to you, such as billingTransactionJoin. Leveraging those joins, you can reach into associated tables to get things like the item's display name, inventory information, or tracking numbers when an item ships.
I have been unable to find a way to sort the results, other than filling a dataset and sorting after the fact. If anyone has a better way, please let me know.
Here's an example that actually does the paging correctly.