【发布时间】:2019-09-13 06:34:05
【问题描述】:
我正在尝试在 SuiteScript 中获取客户的默认送货地址和帐单地址。
var shipaddress = null;
var billaddress = null;
//Find the default billing and shipping addresses
var add_Count = customerRec.getLineCount('addressbook');
for (var i = 1; i <= add_Count; i++){
customerRec.selectLine('addressbook', i);
var def_Bill = customerRec.getCurrentSublistValue('addressbook', 'defaultbilling');
var def_Ship = customerRec.getCurrentSublistValue('addressbook', 'defaultshipping');
if(def_Bill){
billaddress = customerRec.getCurrentSublistSubrecord('addressbook', 'addressbookaddress');
} else if(def_Ship){
shipaddress = customerRec.getCurrentSublistSubrecord('addressbook', 'addressbookaddress');
}
}
有了这个代码,我可以得到第一个,但是一旦它命中
customerRec.selectLine('addressbook', i);
第二次抛出错误。
SSS_INVALID_SUBLIST_OPERATION
You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.
【问题讨论】:
标签: suitescript2.0