添加订单项后,交易列公式字段是否可以更新?或者仅在记录保存后

Can a transaction column formula field update after line item is added? Or only after record save

我想在支出报告支出行上创建一个 "Total Line" 字段,将税收金额添加到小计 "amount" 中,以给出该特定支出的总计。 但我的问题是,添加该行后,它是空白的。 它只有在您保存记录后才有效,但这对员工输入费用时没有太大帮助。 这是 NetSuite 的限制吗? 我是否必须放入一个脚本,在添加一行后以某种方式刷新记录?我不熟悉脚本。

公式为{金额} + ({金额} * {taxrate1}) + ({amount} * {taxrate2})

字段 ID 为 custcol_total_line

谢谢

http://i.imgur.com/NWTzrai.jpg

下面是我将使用的字段更改功能。我会使用下面的函数将其设为客户端脚本。如果线上的数量发生变化,这将在当前触发。

/**
 * The recordType (internal id) corresponds to the "Applied To" record in your script deployment. 
 * @appliedtorecord recordType
 * 
 * @param {String} type Sublist internal id
 * @param {String} name Field internal id
 * @param {Number} linenum Optional line item number, starts from 1
 * @returns {Void}
 */
function clientFieldChanged(type, name, linenum){
    if(type == 'item' && name == 'amount'){
        var amount = nlapiGetLineItemValue('item','amount', linenum);
        var taxRate1 = nlapiGetLineItemValue('item','taxrate1', linenum);
        var taxRate2 = nlapiGetLineItemValue('item','taxrate2', linenum);

        var totalLineAmt = amount + (amount*taxRate1) + (amount*taxRate2);
        nlapiSetLineItemValue('item', 'custcol_total_line', linenum, totalLineAmt);
    }
}

我在执行上述操作时遇到了问题,所以我向 NetSuite 寻求帮助,如果它对其他人有用,这就是我们最终得到的结果。我们把它作为一个验证行函数来做。我将它添加到费用报告表的自定义代码中。非常感谢您的帮助@TMAnn

function validatetotalline(type){
    if(type == 'expense'){
    var amount = parseFloat(nlapiGetCurrentLineItemValue('expense','amount'));
    var taxRate1 = parseFloat(nlapiGetCurrentLineItemValue('expense','taxrate1'));
    var taxRate2 = parseFloat(nlapiGetCurrentLineItemValue('expense','taxrate2'));

    var totalLineAmt = (amount) + (amount*taxRate1/100) + (amount*taxRate2/100);
    nlapiSetCurrentLineItemValue('expense', 'custcol_total_line', totalLineAmt);
    return true;

}
}