简体   繁体   English

使用 SuiteScript 2.0 更新 Netsuite 中的自定义地址字段

[英]Update Custom Address Field in Netsuite using SuiteScript 2.0

I created a new custom field in the 'US' address form called 'email', so I can have an email address associated with both the bill to and ship to on a sales order in Netsuite.我在名为“电子邮件”的“美国”地址表单中创建了一个新的自定义字段,因此我可以拥有一个与 Netsuite 中的销售订单上的帐单和发货地址相关联的电子邮件地址。 I am trying to update this field using Suitescript 2.0, but cannot seem to save the changes.我正在尝试使用 Suitescript 2.0 更新此字段,但似乎无法保存更改。 Can anyone give any insight?任何人都可以提供任何见解吗?

var salesorder = record.load({
    type: record.Type.SALES_ORDER, 
    isDynamic: true,
    id: 6835
});

var shippingAddressSubrecord = salesorder.getSubrecord({fieldId : 'shippingaddress'});
var email = shippingAddressSubrecord.getValue({fieldId : 'custrecord_email_address' }); //returns correctly
shippingAddressSubrecord.setValue({fieldId : 'custrecord_email_address', value: 'test2@gmail.com', ignoreFieldChange: true });

var salesorderid = salesorder.save({enableSourcing: true, ignoreMandatoryFields: true});

This gives the error: "type":"error.SuiteScriptError","name":"OPERATION_IS_NOT_ALLOWED","message":"The subrecord line has already been committed or cancelled. The previous subrecord reference is no longer valid. You must get another reference to the subrecord in order to perform this operation.",这给出了错误:"type":"error.SuiteScriptError","name":"OPERATION_IS_NOT_ALLOWED","message":"子记录行已被提交或取消。以前的子记录引用不再有效。你必须得到另一个对子记录的引用以执行此操作。",

Depends, which script type is this?取决于,这是哪种脚本类型? User Even scripts for example, loading/saving the record would result in an error.用户甚至脚本,例如,加载/保存记录会导致错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM