I am trying to pull cases based on a custom field, however whenever I try this I get the following error:
SearchCustomField is an abstract type and cannot be instantiated
I have already looked through a few previous posts on here and this code previously worked for someone else: Search Customer by custom field in Netsuite
$NSservice = new NetSuiteService();
$NSservice->setSearchPreferences(false, 10);
$cs = new CustomerSearch();
$csb = new CustomerSearchBasic();
$domain = new SearchCustomField();
$domain->internalId = '620';
$domain->searchValue = '8260';
$domain->operator = 'is';
$scfl = new SearchCustomFieldList();
$scfl->customField = array($domain);
$csb->customFieldList = $scfl;
$cs->basic = $csb;
$request = new SearchRequest();
$request->searchRecord = $cs;
$searchResponse = $NSservice->search($request);
Looking at the latest schema searching SupportCases by a custom field is definitely supported.
Looking at your code, the
internalId
of your custom field looks incorrect. Normally, theinternalId
specified in your search is a string, not a number. It will start with the prefixcust
.FWIW the PHP Toolkit has a good bunch of bugs. You may want to consider using the ruby library which supports this operation and is well supported by the open source community.