Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Netsuite:Suitescript 2.0:动态模式记录getSublistValue/getCurrentSublistValue为';行不通_Netsuite_Suitescript_Suitescript2.0 - Fatal编程技术网

Netsuite:Suitescript 2.0:动态模式记录getSublistValue/getCurrentSublistValue为';行不通

Netsuite:Suitescript 2.0:动态模式记录getSublistValue/getCurrentSublistValue为';行不通,netsuite,suitescript,suitescript2.0,Netsuite,Suitescript,Suitescript2.0,概述: 我正在开发Netsuite 2019.2 我被要求使用SuiteScript2.0创建一个供应商付款记录 我使用“N/record”模块创建vendorPayment作为动态模式 但是,基于Suitescript文档 动态模式:当SuiteScript 2.0脚本创建、复制、加载或 在动态模式下转换记录、记录的正文字段和 子列表行项目在中进行来源、计算和验证 实时的。动态模式下的记录模拟记录的行为 在UI中。” 在UI中创建供应商付款时。我在“应用”列表中获得指定供应商的5笔交易 但是,

概述:

我正在开发Netsuite 2019.2

我被要求使用SuiteScript2.0创建一个供应商付款记录

我使用“N/record”模块创建vendorPayment作为动态模式

但是,基于Suitescript文档

动态模式:当SuiteScript 2.0脚本创建、复制、加载或 在动态模式下转换记录、记录的正文字段和 子列表行项目在中进行来源、计算和验证 实时的。动态模式下的记录模拟记录的行为 在UI中。”

在UI中创建供应商付款时。我在“应用”列表中获得指定供应商的5笔交易

但是,当我使用以下代码在Suitescript中创建供应商付款时:

 var billPayment = record.create({
                type: record.Type.VENDOR_PAYMENT, isDynamic: true, defaultValues: { entity: vendorPaymentModel.entity }
            });
并访问子列表“应用”行计数,我得到了5个事务,正如预期的那样:

var numberOfTransactions = billPayment.getLineCount({ sublistId:'apply' });
问题:

当我尝试使用以下两种方法之一访问子列表事务行时,会得到空值

    for (var i = 0; i < numberOfTransactions; i++) {
                    var apply = billPayment.getSublistValue({ sublistId: 'apply', fieldId: 'apply', line: i });
                    var internal = billPayment.getSublistValue({ sublistId: 'apply', fieldId: 'internalid', line: i });
                    var transactionType = billPayment.getSublistValue({ sublistId: 'apply', fieldId: 'trantype', line: i });
                    var amountDue = billPayment.getSublistValue({ sublistId: 'apply', fieldId: 'refnum', line: i });
                    var paymentAmount = billPayment.getSublistValue({ sublistId: 'apply', fieldId: 'amount', line: i });
                    var transactionDate = billPayment.getSublistValue({ sublistId: 'apply', fieldId: 'applydate', line: i });
}
for(var i=0;i
除最后一行外,所有值均为空。

我尝试使用第二种方法,其中:

  • 录制。选择行(选项)

  • Record.getCurrentSublistValue(选项)

  • 记录.提交行(选项)

  • 但它也不起作用


    如果您有任何帮助,我们将不胜感激。如果您需要任何其他澄清或截图,请让我知道

    是否尝试获取多个子列表值?我阅读for循环的方式表明,您期望apply、internal等有多个值。但是您说您只得到1个值,而不是5个值。我认为这是因为当例如I=1时,apply的旧值(第0行)被apply的新值(第1行)覆盖。也许可以尝试使用数组来存储每个数组的所有值(apply、internal等)

    尝试:

    //用于保存值的空数组
    var applys=newArray();
    var internals=newArray();
    var transactionTypes=newArray();
    var amountDues=newArray();
    var paymentAmounts=newArray();
    var transactionDate=新数组();
    对于(var i=0;i
    在以后的代码中,如果现在调用“apply”,则必须执行for循环并调用“applys[x]”


    我不熟悉这个网站,也不熟悉在NetSuite中使用脚本,但我希望这对您有所帮助。

    您是否尝试获取多个子列表值?我阅读for循环的方式表明,您期望apply、internal等有多个值。但是您说您只得到1个值,而不是5个值。我认为这是因为当例如I=1时,apply的旧值(第0行)被apply的新值(第1行)覆盖。也许可以尝试使用数组来存储每个数组的所有值(apply、internal等)

    尝试:

    //用于保存值的空数组
    var applys=newArray();
    var internals=newArray();
    var transactionTypes=newArray();
    var amountDues=newArray();
    var paymentAmounts=newArray();
    var transactionDate=新数组();
    对于(var i=0;i
    在以后的代码中,如果现在调用“apply”,则必须执行for循环并调用“applys[x]”

    我是这个网站的新手,也是w
    //empty arrays to hold values
    var applys = newArray();
    var internals = newArray();
    var transactionTypes = newArray();
    var amountDues = newArray();
    var paymentAmounts = newArray();
    var transactionDate = new array();
    
    
    for (var i = 0; i < numberOfTransactions; i++) {
    
    //for each line get the value
    var apply = billPayment.getSublistValue({ sublistId: 'apply', fieldId: 'apply', line: i });
    var internal = billPayment.getSublistValue({ sublistId: 'apply', fieldId: 'internalid', line: i });
    var transactionType = billPayment.getSublistValue({ sublistId: 'apply', fieldId: 'trantype', line: i });
    var amountDue = billPayment.getSublistValue({ sublistId: 'apply', fieldId: 'refnum', line: i });
    var paymentAmount = billPayment.getSublistValue({ sublistId: 'apply', fieldId: 'amount', line: i });
    var transactionDate = billPayment.getSublistValue({ sublistId: 'apply', fieldId: 'applydate', line: i });
    
    //now save the current values in the array before getting the next set of values
    applys.push(apply);
    internals.push(internal);
    transactionTypes.push(transactionType);
    amountDues.push(amountDue);
    paymentAmounts.push(paymentAmount);
    transactionDate.push(transactionDate);
    
    }