title: Netsuite: Suitescript 2.0: Dynamic Mode Record getSublistValue/getCurrentSublistValue Isn't Working
body: <p><strong>Overview:</strong></p>
  
  <p>I’m working on Netsuite 2019.2. </p>
  
  <p>Using Suitescript 2.0, I’m requested to create a VendorPayment record. </p>
  
  <p>I used the ‘N/record’ module to create vendorPayment as dynamic mode. </p>
  
  <p>However, based on Suitescript documentation. </p>
  
  <blockquote>
    <p>Dynamic mode: When a SuiteScript 2.0 script creates, copies, loads, or
    transforms a record in dynamic mode, the record’s body fields and
    sublist line items are sourced, calculated, and validated in
    real-time. A record in dynamic mode emulates the behavior of a record
    in the UI.”</p>
  </blockquote>
  
  <p>When I create the vendor payment in UI. I get 5 transactions of a specified vendor in the “apply” list. </p>
  
  <p>However, when I create the vendor payment in Suitescript using the following code: </p>
  
  <pre><code> var billPayment = record.create({
                  type: record.Type.VENDOR_PAYMENT, isDynamic: true, defaultValues: { entity: vendorPaymentModel.entity }
              });
  </code></pre>
  
  <p>And access the sublist “apply” line count, I got <strong>5</strong> transactions, as expected: </p>
  
  <pre><code>var numberOfTransactions = billPayment.getLineCount({ sublistId:'apply' });
  </code></pre>
  
  <p><strong>Problem:</strong></p>
  
  <p>When I try to access the sublist transaction lines using one of the following two approaches, I get empty values. </p>
  
  <pre><code>    for (var i = 0; i &lt; 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 });
  }
  </code></pre>
  
  <p><strong>All of the values are empty, except the last line.</strong> </p>
  
  <p>I tried to switch to use the second approach where: </p>
  
  <ol>
  <li><p>Record.selectLine(options)</p></li>
  <li><p>Record.getCurrentSublistValue(options)</p></li>
  <li><p>Record.commitLine(options)</p></li>
  </ol>
  
  <p>But It doesn't work either. </p>
  
  <p>Please any help, would be much appreciated. If you need any other clarifications or screenshots, please let me know. </p>