CustomFieldRef is an abstract type and cannot be i...
# ask-stanley-ai
p
CustomFieldRef is an abstract type and cannot be instantiated
c
AI generated answer (using internal Slack threads):
Based on the conversations provided, it seems that the issue revolves around the instantiation of abstract types in NetSuite, specifically
SearchCustomField
,
SearchColumnCustomField
, and
SelectCustomFieldRef
. 1. For the
SearchCustomField
issue, it seems that the user was trying to instantiate
SearchCustomField
directly, which is not allowed as it is an abstract type. Instead, the user should instantiate a specific type of
SearchCustomField
. Here is a corrected code sample:
Copy code
php
$NSservice = new NetSuiteService();

$cs = new CustomerSearch();
$csb = new CustomerSearchBasic();

$customField = new SearchStringCustomField();
$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);
In this code,
SearchStringCustomField
is used instead of
SearchCustomField
. 2. For the
SearchColumnCustomField
issue, the user was trying to instantiate
SearchColumnCustomField
directly, which is not allowed as it is an abstract type. Instead, the user should instantiate a specific type of
SearchColumnCustomField
. The user should specify the type of the custom field in the
xsi:type
attribute of the
customField
element in the SOAP request. For example, if the custom field is a boolean, the user should use
SearchColumnBooleanCustomField
. 3. For the
SelectCustomFieldRef
issue, the user was trying to change a
SelectCustomFieldRef
to a
multiSelectCustomFieldRef
. It's not as simple as changing
SelectCustomFieldRef
to
multiSelectCustomFieldRef
and passing an array instead of the internalID. The user would need to create a new
MultiSelectCustomFieldRef
object and assign an array of
ListOrRecordRef
objects to its
value
property. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.805681586
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.803924
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.781084538
Please provide your feedback on this answer.