Reputation: 65
I've only just started using Netsuite for a client, and I need to get a list of all items. I've searched a bit but can't find anything and it's pretty urgent. At the minute I can search but it's coming back with the entire recordList, which I then have to loop over and grab the salesDescription object out of each to put into an array.
Coming from PHP this seems incredibly long winded and no doubt wrong, does anyone have any examples of a better way of searching like this as it's taking about 10 seconds to run the search?
make that 10 minutes! I knew it was going to be slow so I'm doing a cron to cache the list to a json object so it's not massively important, but there must be a better way?
Upvotes: 0
Views: 2402
Reputation: 1164
Create saved search within NetSuite with search criteria and results columns. You can add sorting and other search features.
Use ItemSearchAdvanced object to call your saved search and process your records.
Should be very quick.
In your search preferences, you can define page size (number of records returned) in a single call, and then page through the results using SearchMoreWithSearchId function.
Upvotes: 0
Reputation: 197
Approaching the issue from another angle, it is much more efficient to utilize NetSuite's read only ODBC driver when extracting information.
The only downside, is this approach requires the NetSuite Analytics module to be activated and there is an approx $300 per month charge for your client to do so.
Information on SuiteAnalytics module: http://www.netsuite.com/portal/products/suiteanalytics.shtml
ODBC Setup Steps (from 3rd party website): http://blog.prolecto.com/2009/03/27/netsuite-delivers-on-odbc/
Upvotes: 1
Reputation: 804
If you are using the PHP_Toolkit, the Netsuite API allows you to run searches. You should be able to search for the criteria you need and only receive the records that match. You can also set the search preferences to only return a certain number of results (i.e. only return the first 100 results).
I am not sure quite what you are trying to optimize, but here are some options:
Normally I have found that doing a Netsuite searching using the PHP_Toolit takes 20 seconds or less. However, if you are running the code as mulitple users, there is a problem with conflicting wsdls.
If you are interested, I have several examples of using the PHP_Toolkit for searches on my blog:
Upvotes: 0