简体   繁体   中英

NetSuite WebServices Basic Search (Php)

I'm a newbie in NetSuite SuiteTalk API and i really have hard time to get simple results. I'm using the PhpToolKit provide by NetSuite. My Search is super simple, i want Budget list for a given Budget Category and Date. i'm able to do this search without problem into NetSuite and i've got results. I also did this Search in NetSuite with the login account i provide to the NsConfig.php without any right issues. Each time i submit this request i got an error message "INVALID_KEY_OR_REF" in the xml response. If someone got any Clue to help start with it.

Here my code:

 <?php require_once '../PHPToolkit_2018_1/NetSuiteService.php'; $service = new NetSuiteService(); $service->setSearchPreferences(false, 1000); $BudgetSearch = new BudgetSearchBasic(); $CategorySearchField = new SearchMultiSelectField(); setFields($CategorySearchField, array('operator' => 'anyOf', 'searchValue' => 'Legacy')); $BudgetSearch->category = $CategorySearchField; $YearSearchField = new SearchMultiSelectField(); setFields($YearSearchField, array('operator' => 'anyOf', 'searchValue' => 'FY 2018')); $BudgetSearch->year = $YearSearchField ; $query = new SearchRequest(); $query->searchRecord = $BudgetSearch; $BudgetResponse = $service->search($query); if (!$BudgetResponse->searchResult->status->isSuccess) { echo "SEARCH ERROR"; } else { echo "SEARCH SUCCESS, records found: " . $BudgetResponse->searchResult->totalRecords; } 

Make searchValue the internal ID of 'Legacy'.

Or, create the search in the UI and just call the search. So much easier to do it this way, and you don't have to change your code if you want to change the search.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM