我正在把头发拉出来。我正在尝试使用SearchColumnSelectCustomField
类型的自定义字段过滤已保存的搜索(请参阅下面的记录XML)。
如何正确转换此类型,或者我在这里做错了什么? 我不确定我错过了什么,但我总是最终遇到的错误是:
“无法隐式转换类型 'NetSuite.com.netsuite.na1.webservices.SearchColumnSelectCustomField' 到'NetSuite.com.netsuite.na1.webservices.SearchCustomField' “
TransactionSearchAdvanced transSearchAdv = new TransactionSearchAdvanced
{
savedSearchScriptId = "customsearch_mycustomsearch"
};
SearchColumnSelectCustomField cwoNumField = new SearchColumnSelectCustomField();
cwoNumField.internalId = "custbody_consolidatedworkorder";
transSearchAdv.criteria = new TransactionSearch
{
basic = new TransactionSearchBasic
{
//Error Here, on cwoNumField
customFieldList = new SearchCustomField[]{ cwoNumField }
}
};
搜索结果的XML,未添加过滤条件:
<tranSales:basic xmlns:platformCommon="urn:common_2014_1.platform.webservices.netsuite.com">
<platformCommon:appliedToTransaction>
<platformCore:searchValue internalId="442671"/>
<platformCore:customLabel>SO #</platformCore:customLabel>
</platformCommon:appliedToTransaction>
<platformCommon:item>
<platformCore:searchValue internalId="315838"/>
</platformCommon:item>
<platformCommon:quantity>
<platformCore:searchValue>11.0</platformCore:searchValue>
</platformCommon:quantity>
<platformCommon:status>
<platformCore:searchValue>pendingBuild</platformCore:searchValue>
</platformCommon:status>
<platformCommon:transactionNumber>
<platformCore:searchValue>204</platformCore:searchValue>
<platformCore:customLabel>WO #</platformCore:customLabel>
</platformCommon:transactionNumber>
<platformCommon:customFieldList>
<platformCore:customField xsi:type="platformCore:SearchColumnBooleanCustomField" scriptId="custbody_buildcomplete" internalId="501">
<platformCore:searchValue>false</platformCore:searchValue>
</platformCore:customField>
/*********** field in question here *************/
<platformCore:customField xsi:type="platformCore:SearchColumnSelectCustomField" scriptId="custbody_consolidatedworkorder" internalId="500">
<platformCore:searchValue typeId="85" internalId="24"/>
<platformCore:customLabel>CWO #</platformCore:customLabel>
</platformCore:customField>
</platformCommon:customFieldList>
</tranSales:basic>
答案 0 :(得分:0)
我不确定为什么,但这就是答案。有人可以解释为什么通过SearchColumnSelectCustomField
搜索SearchMultiSelectCustomField
字段吗?
TransactionSearchAdvanced transSearchAdv = new TransactionSearchAdvanced
{
savedSearchScriptId = "customsearch_woconsolidationsublist"
};
SearchMultiSelectCustomField cwoNumField = new SearchMultiSelectCustomField();
cwoNumField.scriptId = "custbody_consolidatedworkorder";
cwoNumField.@operator = SearchMultiSelectFieldOperator.anyOf;
cwoNumField.operatorSpecified = true;
cwoNumField.searchValue = new ListOrRecordRef[] { new ListOrRecordRef {internalId = "36"} };
transSearchAdv.criteria = new TransactionSearch
{
basic = new customFieldList = new SearchCustomField[] { cwoNumField }
}
};