如何在 RESTlet 中使用 SuiteScript 将销售订单的承运商设置为更多?

How can I set the shipcarrier to More on a sales order using SuiteScript in a RESTlet?

SuiteScript v1,但如果这是让它工作的唯一方法,我会切换到 SS v2。

我试过:

salesOrder.setFieldText('shipcarrier', 'More');
salesOrder.setFieldValue('shipcarrier', 'noups');
salesOrder.setFieldValue('shipcarrier', 'nonups');

但保存记录后始终选择 UPS。

您需要使用 setFieldValue 并传递 "More" 运输公司的内部 ID。

nlapiSubmitField('salesorder', recordid, 'shipcarrier', 'nonups');

航母有点奇怪。

我不确定它是否真的很粘 - 在某些情况下它似乎是粘性的,而在某些情况下则不是。

除非您还设置了 shipmethod,否则设置似乎毫无意义。

salesOrder.setFieldValue('shipcarrier', ffShipCarrier); //'ups' || 'nonups'
salesOrder.setFieldValue('shipmethod', ffShipMethod)

PS 来自 cja:我的 conclusion/solution:设置 shipmode 不执行任何操作,除非 recordmode 是动态的并且同时设置了 shippethod。如果这两个条件都满足,那么值 shipmode 将被更新。

NetSuite 支持人员警告我不要使用此解决方案:

“关于您的问题,我可以在客户端脚本中的销售订单记录中设置承运人字段 (nlapiSetFieldValue('shipcarrier', 'ups');) 但是我当时无法在服务器端脚本中设置该字段的值。经进一步调查,该字段(承运人)未在记录浏览器中公开,因此该字段未正式公开以满足脚本需求。请参考以下 Suiteanswer文章供您参考。

“我很高兴该解决方案完美地为你工作。为了进一步解释,我会说在记录浏览器中使用未公开字段编写脚本是不可取的。它可能会在未来改变而没有任何事先通知并可能导致问题,NetSuite 对此不承担任何责任。

"User groups contains simple solution to complex tips and tricks provided by the experienced customers. On the other hand, NetSuite Support are stickly adhering to the official documentation/processes to assist any of its customer. The solutions provided in the User groups are totally upto the consent of the customers and can be implemented at their own risk if not confirmed in the official documentation or NetSuite Support."