Я пытаюсь получить адреса доставки и биллинга по умолчанию для клиента в 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.