【问题标题】:Get the shipping and billing address of a customer in SuiteScript在 SuiteScript 中获取客户的送货地址和帐单地址
【发布时间】: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


    【解决方案1】:

    我找到了答案。请看下文。

    var add_Count = customerRec.getLineCount('addressbook');
    for (var i = 0; i < add_Count; i++){
        var def_Bill = customerRec.getSublistValue('addressbook', 'defaultbilling', i);
        var def_Ship = customerRec.getSublistValue('addressbook', 'defaultshipping', i);
        var anAddress = customerRec.getSublistSubrecord('addressbook', 'addressbookaddress', i);
        if(def_Bill){
            billaddress = anAddress;
        } else if(def_Ship){
            shipaddress = anAddress;
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2014-08-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多