2017-07-14 26 views
0

我正在付款屏幕上撰写用户事件脚本beforeSubmit。如何在付款记录创建之前参考正在付款的账单的交易ID?我需要知道我是否支付费用报告或正常的供应商帐单,因此我可以在检查号字段前加上。这是我迄今为止所拥有的。Suitescript 2如何在付款页上提交之前引用帐单交易ID

define(['N/record'], 
function(record) { 
    function beforeSubmit(context) { 
     if (context.type !== context.UserEventType.CREATE) 
      return; 

     var customerRecord = context.newRecord; 

>>>>>> Not sure how to reference the Vendor Bill <<<<< 

     var newprefix = 'EXP'; 
     newprefix += customerRecord.getValue('tranid'); 
     customerRecord.setValue('tranid', newprefix); 
    } 
    return { 
     beforeSubmit: beforeSubmit 
    }; 
}); 

感谢

***我加入到锻炼,如果卖方比尔的费用报表代码:

var index = paymentRecord.findSublistLineWithValue({"sublistId": "apply", "fieldId": "apply", "value": "T"}); 

    var sublistFieldTranstype = paymentRecord.getSublistValue({ 
     sublistId: 'apply', 
     fieldId: 'trantype', 
     line: index 
    }); 

    if (sublistFieldTranstype !== 'ExpRept') 
     return; 

回答

1

你需要检查apply子表,看看哪些您的付款记录正被应用于交易。

有关apply子列表中所有可用字段的信息,请参阅Vendor Payments Record Browser

+0

感谢您的指针。当我弄明白的时候,我会发布我的代码。 – FPS

+0

上面添加的代码。 – FPS

相关问题