java - NetSuite SuiteTalk SOAP Api:仅更新记录中的某些字段
问题描述
我们在更新 NetSuite 销售订单时遇到了问题(特别是我们正在更新自定义字段),但是我们甚至没有在代码中明确写入一些只读字段。
我们检索订单,更新自定义字段,然后调用WriteResponse rc = this.nsPort.update(order);
where order
is an instance of SalesOrder
pull byinternalID
并且nsPort
is an instance of NetSuitePortType
。调用update()
失败并出现异常:
java.lang.Exception: You do not have permissions to set a value for element subtotal
due to one of the following reasons: 1) The field is read-only; 2) An associated feature
is disabled; 3) The field is available either when a record is created or updated, but
not in both cases.
哪个字段是只读的在这里并不重要,重要的是我们(无意中)发回涉及只读字段的更新。
令我震惊的是,理想情况下,我们只会发送仅写入我们感兴趣的自定义字段的更新。
有没有办法从 NetSuite 中提取一条记录,然后只更新某些字段?或者有没有办法在我们调用时通知 SuiteTalk 只更新某些字段update()
?
解决方案
如果您只想更新某些字段,只需将您想要更新的字段与internalId
. 例如,要仅更新备忘录和销售订单上的自定义字段,请使用(在 python 中):
sales_order = soap.sales.SalesOrder(
internalId=12,
memo='I updated the memo, but I did not shoot the deputy',
customFieldList=soap.core.CustomFieldList(customField=[
soap.core.CustomString(scriptId='custbody_memo', value='I also did not shoot the deputy'),
])
)
soap.update(sales_order)
这将生成一个仅包含自定义正文备注字段internalId
的xml。memo
Netsuite 只会更新包含在soap 消息中的那些字段。
推荐阅读
- rust - 匹配宏中的多个枚举类型
- tensorflow - 尺寸必须等于误差,但它们是相等的
- javascript - Day.js 从本周日或本周日获取当前日期?
- java - 在 Windows 10 上的 WSL2 上使用 JDK 的正确方法是什么?
- php - 属性 [livewire] 不存在
- python - Apache Beam 数据流管道 - 具有高 Wall time 的简单 DoFn
- reactjs - 在 React 中使用 Firebase Auth 创建新用户时出现内部错误
- python - 协助 Python 3.x 上的测量转换程序
- reactjs - 渲染一个动态加载的 React 组件
- python - 将大容量数据从 pandas df 插入到 postgresql 时出现语法错误