2017-07-14 60 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