在某些情况下,我试图将采购订单上的税号从默认代码更改为另一种。我已将脚本放入后期采购中,它可以按预期更改税码。但是,保存采购订单后,它将再次放回默认税码!
后采购中的代码如下。非常感谢您提供任何帮助!
// Set Tax Code
function setTaxCode(scriptContext){
var currentRecord = scriptContext.currentRecord;
var RecType = scriptContext.currentRecord.type;
var sublistName = scriptContext.sublistId;
var sublistFieldName = scriptContext.fieldId;
var line = scriptContext.line;
if (sublistName == 'item' && sublistFieldName == 'item'){
var itemType = currentRecord.getCurrentSublistValue({sublistId:sublistName,fieldId:'itemtype'});
var item = currentRecord.getCurrentSublistValue({sublistId:sublistName,fieldId:'item'});
if (item != '' && itemType != ''){
var expAccount = getExpenseAccount(item,itemType);
if (expAccount == null)
{var expAccountType = null}
else
{var expAccountType = getExpenseAccountType(expAccount);}
if (expAccountType == 'Fixed Asset'){
currentRecord.setCurrentSublistText({sublistId:sublistName,fieldId:'taxcode_display', text:'GST:Capital Purchases', ignoreFieldChange: true});
}
}
问题终于得到了解决。原来,我被NetSuite Field Explorer插件“迷住了”,该插件将fieldid显示为“ taxcode_display”,但实际的fieldid是“ taxcode”。相同的代码可以将fieldid更改为“ taxcode”。
谢谢!