SuiteScript接口开发与沙盒的兼容性

对于只有正式账号,没有沙盒账号的环境而言,不太需要在设计的时候考虑接口与沙盒环境的兼容性。而对于一部分有多个沙盒账号的环境而言,沙盒的兼容性尤为重要,否则刷沙盒可能造成外部系统的混乱。 Suitelet做endpoint 用suitelet作为接口确实有一些hacky(因为suitelet原生是不带验证的,一旦url被滥用可能非常尴尬),但是确实有开发者会使用它。 在外部系统调用suitelet的时候需要考虑的东西不会太多,主要是账号的后缀-sb需要正确,它意味着正确的系统环境;而h参数一样决定了访问是否成功。 对于suitelet类型的脚本每次刷新之后系统会更新h这个参数,因此你的url每次刷新都需要改变。 Restlet类型的脚本 Restlet脚本在沙盒兼容性上考虑的最少。 外部系统调用restlet的时候需要考虑到账号的-sb参数以及realm(针对OAuth1.0) 对于restlet类型脚本,每次刷新之后需要考虑重新创建Integration以确保获得正确的token和secret 其他脚本 其他脚本包括了所有可能通过http、https请求向外部发送请求数据的脚本,包括但不限于MapReduce, Scheduled, UserEvent等服务器端的脚本,实现的目的包括推送、更改、获取数据等等。 在设计上,有两种思路: 以上都需要用到N/runtime 如果应用了以上的设计思路,那么正式环境和沙盒环境可以实现脚本互相通用,刷新了沙盒环境也无需顾虑。如果没有采取以上的设计思路,则需要在沙盒环境刷新之后尽快调整脚本的部署,尤其是定时类型的脚本,比如MapReduce和Scheduled。

nlapiSubmitField and record.submitFields(options) are not Setting the Value of Custom Fields on Inbound Shipment Records

Scenario As per Issue: 505122, the SuiteScript API nlapiSubmitField does not set the value on custom fields applied to the Inbound Shipment record. However, the following workaround can be used to overcome this limitation till the issue is resolved. Solution 1. Load the required Inbound Shipment record;2. Set the value of the custom field;3. Submit the... » read more

在NetSuite中用SuiteScript脚本创建Inbound Shipment Record

你可能看到这样的错误: 根据NetSuite提供的数据结构,必填字段是purchaseorder, shipmentitem。一般来说purchaseorder是PO的internalid,而shipmentitem如果填写item的internalid则会报错,因为这里实际指的是PO的lineuniquekey 分享一个例子,请替换ID、适当添加字段。

Create Inbound Shipment Record using SuiteScript in NetSuite

You may find these errors According to the Schema, the mandatory fields are purchaseorder, shipmentitem. Yes, that purchaseorder refers the internalid of purchase order, but the shipmentitem does not mean the item ids of the item on the PO – it’s actually lineuniquekey of PO items! Here is a working example and all you need... » read more

时间已定Scheduled脚本没有log直接状态变成错误

问题: 一个预定的脚本无法按照其执行计划执行。当手动触发脚本时,执行状态会变为失败,并且即使在第一行中放置了log.debug(),也不会记录执行日志。 解决方案: 可能是因为文件名缺少扩展名导致的。当在文件名末尾添加*.js时,它可以正常工作。

Scheduled Script fails without execution log

Problem A scheduled script doesn’t execute according to its execution schedule. Its execution status becomes Failed when the script is triggered manually and no execution log is recorded even log.debug() has been placed in the first line. Solution This could be because the extension name is missing. It works when *.js is appended to the... » read more