Has anyone else has this problem: SearchCustomFiel...
# general
j
Has anyone else has this problem: SearchCustomField is an abstract type and cannot be instantiated when using the php toolkit?
p
I don't use webservices too much, but took a little look and it doesn't seem to be created as an abstract class. Is there any possibility that there's a duplicate definition for SearchCustomField? It's just I did notice that the NetSuiteService.php will only create the class "it's way" if it doesn't already exist if (!class_exists("SearchCustomField")) // then creates class... Can you navigate to definition and see what that shows?
j
Sorry, im fairly new to this not sure what you mean by navigate to definition?
ahh I get you now, so this is what I have so far
$customField = new SearchCustomFieldList(); $customField->SearchCustomField->internalId = '440'; $customField->SearchCustomField->operator = 'is'; $customField->SearchCustomField->scriptId = 'custevent_service_credit_deducted'; $customFieldList->customField = $customField; $search->customFieldList = $customFieldList; $request = new SearchRequest(); $request->searchRecord = $search;
p
Hi Josh, Sorry for the delayed response. I've been a bit busy lately. Ah, that's not quite what I meant. I guess you're using an IDE like visual studio code or webstorm? Within those, you can usually select SearchCustomField and press something like F12 (vscode and visual studio) or CTRL+B (webstorm) and it will take you to where that class has been created.
I haven't tested this, and it's mostly adapted from this stack answer: https://stackoverflow.com/a/19504659/1219112
$NSservice = new NetSuiteService(); $cs = new CustomerSearch(); $csb = new CustomerSearchBasic(); $customField = new SearchCustomField(); $customField->internalId = 'custevent_service_credit_deducted'; $customField->searchValue = '440'; $customField->operator = 'anyof'; $customFieldList = new SearchCustomFieldList(); $customFieldList->customField = array($customField); $csb->customFieldList = $customFieldList; $cs->basic = $csb; $request = new SearchRequest(); $request->searchRecord = $cs; $searchResponse = $NSservice->search($request);