1

I'm working with NetSuite PHP Toolkit(2013_2 version). And I was able to make successful Saved-Search and Customer-Search. Except that, my actual customers are 1800 in total, whereas I get only 1000 records from my NetSuite call. So I need to know, if we can fetch all the records(more than 1000) in a NetSuite call using PHP toolkit. My code goes like this basically...

$service = new NetSuiteService();
$search = new CustomerSearchAdvanced();
$search->savedSearchId = "115"; //internal ID of saved search

$request = new SearchRequest();
$request->searchRecord = $search;

$searchResponse = $service->search($request);

Thanks in advance!!

David Rogers
  • 2,601
  • 4
  • 39
  • 84
G.J
  • 477
  • 1
  • 7
  • 22

1 Answers1

9

1000 Records is a hard limit. You have to use searchMoreWithId (Docs).

Code should look like this

$searchId = $searchResponse['searchId'];
$request = new SearchMoreWithIdRequest();
$request->searchId = $searchId;
$request->pageIndex = 2;
$moreSearchResponse = $service->searchMoreWithId($request); 
Saqib
  • 2,470
  • 3
  • 19
  • 32
  • Hi @saqib ...Now my records are more than 2000.So I had tried to loop the new SearchMoreWithIdRequest(); call to get all records.But by doing so the execution time is totally huge and sometimes it fails to load data. Do you have any possible advice or idea for this kinda situation? Thanks in Advance!! – G.J May 13 '14 at 10:52
  • 1
    @ShanG I am afraid that there's no perfect way to optimize this. Either you can cache records to run the process faster or apply serach filters to make the data set small. – Saqib May 14 '14 at 13:32
  • FWIW it's definitely worth trying to use search filters to get the results you want computed server-side, and they're optimized to be extremely quick. It is unfortunate that the documentation doesn't really provide a lot of good examples on how to combine them, but it's basically a matter of nesting arrays with "AND" or "OR" between them. It's even possible to enter formulas like the ones used in saved searches, but you may wish to search for an example on how to do it - the field name is a special formula keyword based on the datatype to compare, & the value takes the actual formula string. – Darren Ringer Dec 05 '18 at 20:41