简体   繁体   English

NetSuite WebServices基本搜索(Php)

[英]NetSuite WebServices Basic Search (Php)

I'm a newbie in NetSuite SuiteTalk API and i really have hard time to get simple results. 我是NetSuite SuiteTalk API的新手,我真的很难获得简单的结果。 I'm using the PhpToolKit provide by NetSuite. 我正在使用NetSuite提供的PhpToolKit。 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. 我能够毫无问题地对NetSuite进行此搜索,并且得到了结果。 I also did this Search in NetSuite with the login account i provide to the NsConfig.php without any right issues. 我也使用我提供给NsConfig.php的登录帐户在NetSuite中进行了此搜索,没有出现任何问题。 Each time i submit this request i got an error message "INVALID_KEY_OR_REF" in the xml response. 每次我提交此请求时,我都会在xml响应中收到一条错误消息“ INVALID_KEY_OR_REF”。 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'. 将searchValue设为“旧版”的内部ID。

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. 这样做起来非常容易,并且如果您要更改搜索,则不必更改代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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