【问题标题】:Issues Transforming a Sales Order Record to Item Fulfillment & Cash Sale将销售订单记录转换为项目履行和现金销售的问题
【发布时间】:2017-03-03 04:21:53
【问题描述】:

我正在尝试创建一个简单的 afterSubmit 用户事件脚本,该脚本会立即为销售订单上的礼券项目创建项目履行记录和现金销售。但是,我一直在项目履行部分遇到问题,其中显示其他项目但不显示礼品证书。例如,我将有 4 件物品,其中两件是礼券。项目履行中只会显示两个项目。两者都不是礼品卡。

现金销售转换也不允许我删除订单项。我什至尝试在创建后直接打开新创建的现金销售,但没有运气。

有什么想法吗?

function main(type){
    if (type == 'create'){
        //transform for cashsale
        var soId = nlapiGetRecordId();
        var csRec = nlapiTransformRecord('salesorder', soId, 'cashsale');
        var lcount = csRec.getLineItemCount('item');
        for (var i = 1; i <= lcount; i++){
            csRec.selectLineItem('item', i);
            var itemType = csRec.getCurrentLineItemValue('item', 'itemtype', i);
            if (itemType != 'GiftCert') {
                csRec.removeLineItem('item', i);
            }
        }
        nlapiSubmitRecord(csRec);

        //transform for item fulfillment
        var ifRec = nlapiTransformRecord('salesorder', soId, 'itemfulfillment');
        var lcounttwo = ifRec.getLineItemCount('item');

        for (var i = 1; i <= lcounttwo; i++){
            ifRec.selectLineItem('item', i);
            var ifType = ifRec.getCurrentLineItemValue('item', 'itemtype', i);
            if (ifType != 'GiftCert') {
                ifRec.removeLineItem('item', i);
            }
        }
        nlapiSubmitRecord(ifRec);
    }
}

【问题讨论】:

    标签: javascript transform netsuite suitescript


    【解决方案1】:

    根据您的礼品证书的设置方式,可能的问题是礼品证书的设置可能无法兑现/接收。

    如果您转到销售订单并创建现金销售,您应该在那里看到礼品证书,如果您这样做了,那么您的脚本应该只对礼品证书开账单,而不是尝试履行它

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多