[英]Get list of shipping methods for a subsidiary
I'm using NetSweet/NetSuite Ruby gem for connecting to NetSuite accounts.我使用 NetSweet/NetSuite Ruby gem 连接到 NetSuite 帐户。
Normally it's trivial to get list of shipping methods using get_select_value
.通常使用
get_select_value
获取运输方式列表是get_select_value
。 However one NetSuite account is organized into subsidiaries, and shipping methods are assigned to subsidiaries.但是,将一个 NetSuite 帐户组织为子公司,并将运输方式分配给子公司。 For this particular account,
get_select_value
returns empty list:对于此特定帐户,
get_select_value
返回空列表:
NetSuite::Records::BaseRefList.get_select_value({
recordType: "salesOrder",
field: "shipMethod",
}).base_refs.length
=> 0
This makes some sense: in new sales order form the list of shipping methods is initially empty.这是有道理的:在新的销售订单表单中,运输方式列表最初是空的。 When I select "customer" option, NetSuite automatically fills the read-only field "subsidiary".
当我选择“客户”选项时,NetSuite 会自动填充只读字段“子公司”。 Then list of available shipping methods is populated.
然后填充可用的运输方式列表。
Is there a way to fetch list of shipping methods by subsidiary or for a customer?有没有办法按子公司或客户获取运输方式列表?
NetSuite API response contains a warning: "Results are incomplete. You must provide a value for field entity." NetSuite API 响应包含警告:“结果不完整。您必须为字段实体提供值。”
Full response:完整回复:
<getSelectValueResponse xmlns="urn:messages_2016_2.platform.webservices.netsuite.com">
<platformCore:getSelectValueResult xmlns:platformCore="urn:core_2016_2.platform.webservices.netsuite.com">
<platformCore:status isSuccess="true">
<platformCore:statusDetail type="WARN">
<platformCore:code>WARNING</platformCore:code>
<platformCore:message>Results are incomplete. You must provide a value for field entity.</platformCore:message>
</platformCore:statusDetail>
</platformCore:status>
<platformCore:totalRecords>0</platformCore:totalRecords>
<platformCore:totalPages>0</platformCore:totalPages>
</platformCore:getSelectValueResult>
</getSelectValueResponse>
Using filterByValueList and passing customer internalId as entity seems to work.使用 filterByValueList 并传递客户 internalId 作为实体似乎有效。
NetSuite::Records::BaseRefList.get_select_value({
recordType: "salesOrder",
field: "shipMethod",
filterByValueList: {
"platformCore:filterBy" => {
"platformCore:field" => "entity",
"platformCore:internalId" => ns_customer.internal_id}
}
}).base_refs.length
=> 17
It's somewhat counter-intuitive, as filter option should reduce items in the output.这有点违反直觉,因为过滤器选项应该减少输出中的项目。
Generated XML:生成的 XML:
<platformMsgs:getSelectValue>
<platformMsgs:pageIndex>1</platformMsgs:pageIndex>
<platformMsgs:fieldDescription>
<platformCore:recordType>salesOrder</platformCore:recordType>
<platformCore:field>shipMethod</platformCore:field>
<platformCore:filterByValueList>
<platformCore:filterBy>
<platformCore:field>entity</platformCore:field>
<platformCore:internalId>4978501</platformCore:internalId>
</platformCore:filterBy>
</platformCore:filterByValueList>
</platformMsgs:fieldDescription>
</platformMsgs:getSelectValue>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.