希望有人在这里拥有NetSuite经验!我通过Netsuite网络服务访问已保存的搜索以检索销售订单。出于某种原因,订单中的项目通过:
[item] => Array
(
[0] => SearchColumnSelectField Object
(
[searchValue] => RecordRef Object
(
[internalId] => 1088
[externalId] =>
[type] =>
[name] =>
)
它不显示产品代码,而是显示internalId,即使屏幕上保存的搜索正确显示产品。如何从中获取产品代码?
答案 0 :(得分:1)
您选择了错误的列和/或搜索字段值而不是文本或项目字段:名称。我会编辑我的答案,并在找到它时添加更多答案。这是来自我使用suitescript的经历。
使用我看到的referencedocs:发布TRX摘要字段:
<complexType name="PostingTransactionSummaryField">
<sequence>
<element name="period" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
<element name="account" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
<element name="parentItem" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
<element name="item" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
<element name="entity" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
<element name="department" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
<element name="class" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
<element name="location" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
<element name="subsidiary" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
</sequence>
</complexType>
或使用我看到的referencedocs:GetPostingTransactionSummaryResult:
<complexType name="GetPostingTransactionSummaryResult">
<sequence>
<element ref="platformCore:status" minOccurs="1" maxOccurs="1"/>
<element name="totalRecords" type="xsd:int" minOccurs="0"/>
<element name="pageSize" type="xsd:int" minOccurs="0"/>
<element name="totalPages" type="xsd:int" minOccurs="0"/>
<element name="pageIndex" type="xsd:int" minOccurs="0"/>
<element name="postingTransactionSummaryList" type="platformCore:PostingTransactionSummaryList" minOccurs="0" maxOccurs="1"/>
</sequence>
</complexType>
在一个单独的无关主题上,我发现了这个:
指定Web服务上下文
要使表单在Web服务与UI之间的行为不同,您可以执行以下操作之一:
编写特定于上下文的SuiteScript代码并使用nlapiGetContext函数来分支代码
禁用Web服务中的SuiteScript
但是,无论在NetSuite中创建或更新记录的机制如何,都会编写Client和Server SuiteScripts来强制执行可能需要强制执行的自定义业务规则。对于部署SuiteCloud合作伙伴应用程序并希望确保其业务规则仍然受到尊重的客户来说尤其如此。由于Client SuiteScript通常具有需要用户操作的浏览器特定行为,并且无法在Web服务调用期间自动运行,因此NetSuite建议您禁用Client SuiteScript并针对需要在所有情况下强制执行的业务条件部署Server SuiteScript。
若要指定在Web服务调用期间永远不应执行Server SuiteScript,请在“设置”&gt;的“Web服务首选项”页面上启用“禁用服务器端脚本”首选项。整合&gt;网络服务。
重要提示:
仅当通过Web服务提交的数据不需要遵循可通过Server SuiteScript执行的自定义业务逻辑和工作流时,才启用此首选项。
答案 1 :(得分:0)
在搜索偏好设置中将bodyFieldsOnly设置为FALSE。
$NSservice = new NetSuiteService();
$NSservice->setSearchPreferences(false, 100, true);
答案 2 :(得分:0)
<?php
$order_date = date('Y-m-d H:i:s');
// create array of fields
$itemArr = array();
$i = 0;
foreach($order_items_product as $keyProduct =>$valueProduct){
//if you not have internal id of item in netsuuite then please add the item in the netsuite and try.
$netsuiteItemId = 'Your Item Internal id Which is in the Netsuite Item';
$itemArr[$i]['item']['internalId'] = $netsuiteItemId;
$itemArr[$i]['quantity'] = $valueProduct['qty'];
$i++;
}
if (!define('LF', "\n")) {
define('LF', "\n");
}
/* for use in formatting custom addresses since NetSuite converts to <br> */
//Billing Address Information
/* this example has the customer address info in a db record, just pulled into $row */
$billAddress = stripslashes($order->order_custom_fields['_billing_first_name'][0]) . ' ' . $order->order_custom_fields['_billing_last_name'][0] . LF;
$billAddress .= stripslashes($order->order_custom_fields['_billing_address_1'][0]).LF;
$billAddress .= stripslashes($order->order_custom_fields['_billing_address_2'][0]).LF;
$billAddress .= stripslashes($order->order_custom_fields['_billing_country'][0]).LF;
$billAddress .= stripslashes($order->order_custom_fields['_billing_state'][0]) . ' - ' . $order->order_custom_fields['_billing_postcode'][0] . ', ' . LF;
$billAddress .= $order->order_custom_fields['_billing_phone'][0] . ', ' . $order->order_custom_fields['_billing_email'][0];
//Shipping Address Information
$shipAddress = stripslashes($order->order_custom_fields['_shipping_first_name'][0]) . ' ' . $order->order_custom_fields['_shipping_last_name'][0] . LF;
$shipAddress .= stripslashes($order->order_custom_fields['_shipping_address_1'][0]).LF;
$shipAddress .= stripslashes($order->order_custom_fields['_shipping_address_2'][0]).LF;
$shipAddress .= stripslashes($order->order_custom_fields['_shipping_city'][0]).LF;
$shipAddress .= stripslashes($order->order_custom_fields['_shipping_state'][0]) . ', ' . $order->order_custom_fields['_shipping_postcode'][0] . ', ' . LF;
$shipAddress .= $order->order_custom_fields['_billing_phone'][0] .', '. $order->order_custom_fields['_billing_email'][0];
$purchaseOrderFields = array (
'entity' => array ('internalId' => $internal_Id, 'type' => 'customer'),
'shippingCost' => $order->order_shipping,
'shipMethod' => $order->payment_method,
'toBeEmailed' => true,
//'tranId' => $order->order_custom_fields['Transaction ID'][0],
//'tranDate' => date('Y-m-d H:i:s'),
'source' => 'littlecrate',
'createdFrom' => 'littlecrate.com',
'discountRate' => $order->order_custom_fields['_order_discount'][0],
'taxRate' => $order->order_custom_fields['_order_tax'][0],
'email' => $order->billing_email,
//'shipDate' => date('Y-m-d H:i:s'),
'shipMethod' => $order->shipping_method,
'shippingCost' => $order->order_shipping,
'shippingTax1Rate' => $order->order_shipping_tax,
'paymentMethod' => $order->payment_method,
//'taxTotal' => $order->order_tax,
//'total' => $order->order_total,
'billAddress' => $billAddress,
'shipAddress' => $shipAddress,
'itemList' => array (
'item' => $itemArr
)
);
$salesOrder = new nsComplexObject('SalesOrder');
$salesOrder ->setFields($purchaseOrderFields);
$addResponse = $myNSclient->add($salesOrder );
if (!$addResponse->isSuccess) {
echo "Order Information is Not Inserted Into The Netsuite. Please Contact to Administration.";
exit;
}
?>