0

在提交供应商账单并通过预定脚本进行处理时,我们遇到了一个奇怪的问题。

每次脚本尝试调用 nlapisubmitrecord(vendorbil,true, true) 时,都会引发异常:USER_ERROR:请输入帐户/金额的值。

有趣的是,如果在 API 调用之前调用 account 和 amount 的值并且两个值都是正确的。另外,由于我们指定了 IgnoreMandatoryFields = true,不应该忽略这些字段(即使它们是空的?)

所以我们的疑问是:netsuite API 调用发生了变化和中断?会发生吗?

请问有什么帮助吗?

谢谢..

[更新 1]

多谢你们 ....

正在破坏的代码如下:

i = parseInt(nlapiGetLineItemCount('expense'), 10);
while (i > 0) {
    lineSubsidiaryId = isNumber(nlapiGetLineItemValue('expense', 'custcol_project_sub_bill', i)) ? parseInt(nlapiGetLineItemValue('expense', 'custcol_project_sub_bill', i), 10) : origSubsidiary;
    taxCodeId = isNumber(nlapiGetLineItemValue('expense', 'taxcode', i)) ? parseInt(nlapiGetLineItemValue('expense', 'taxcode', i), 10) : -1;
    hasAmortizationSchedule = isNumber(nlapiGetLineItemValue('expense', 'custcol_custom_amortization_schedule', i)) && isNotBlank(nlapiGetLineItemValue('expense', 'custcol_amort_start', i)) && isNotBlank(nlapiGetLineItemValue('expense', 'custcol_amort_end', i));

    if (lineSubsidiaryId !== origSubsidiary) {
        if (VENDORBILL_DEBUG) {
            nlapiLogExecution('DEBUG', 'DH_VendorBill_BeforeSubmit', 'Found a line assigned to a different subsidiary');
        }
        nlapiSetFieldValue('custbody_dh_vendorbill_status', INVOICE_PROCESS_STATUS.Pending);
    } else {
        // Copy the custom 'Allocate to Project' field into the Standard 'customer' field
        // check for blankeness ... don't bother copying
        if (isNumber(nlapiGetLineItemValue('expense', 'custcol_allocate_to_project', i))) {
            nlapiSetLineItemValue('expense', 'customer', i, nlapiGetLineItemValue('expense', 'custcol_allocate_to_project', i));
        }

        // Copy the custom 'Bill End Customer' field into the Standard 'isbillable' field
        nlapiSetLineItemValue('expense', 'isbillable', i, nlapiGetLineItemValue('expense', 'custcol_ec_bill_end_customer', i));
        // Account for Amortization Schedule (See Issue #2)
        if (hasAmortizationSchedule) {
            nlapiSetLineItemValue('expense', 'amortizationsched', i, nlapiLookupField('customrecord_cust_amort_templates', nlapiGetLineItemValue('expense', 'custcol_custom_amortization_schedule', i), 'custrecord_amort_temp_internal_id'));
            nlapiSetLineItemValue('expense', 'amortizstartdate', i, nlapiGetLineItemValue('expense', 'custcol_amort_start', i));
            nlapiSetLineItemValue('expense', 'amortizationenddate', i, nlapiGetLineItemValue('expense', 'custcol_amort_end', i));
        }

        if (taxCodeId !== -1) {
            nlapiSetLineItemValue('expense', 'taxcode', i, taxCodeId);
        }
    }
    i = i - 1;
}
4

2 回答 2

1

检查您是否添加了比需要更多的行项目,并且您正在提交所有行。

于 2016-02-11T13:50:27.870 回答
0

谢谢大家的帮助....我们找到了解决方案和根本原因。

作为最近开发工作的一部分,我们在行项目的一个字段中引入了过滤器。该过滤器没有返回值并且以某种方式添加了空行。在我们删除那个过滤器之后,现在脚本开始工作得很好。

奇怪的问题..但很高兴我们可以解决它..

于 2016-02-14T04:01:59.303 回答