title: NetSuite script to update one line level field from another after submit
body: <p>First, I'm very new to scripting in NetSuite, so please forgive the scrappy code.</p>
  
  <p>I'm trying to create a script (yes, I know this can be done in a workflow) that loops back through the lines of a sales order and copies the line 'amount' over to the 'altsalesamt' field after the order is saved.  The script runs okay but doesn't actually do anything.</p>
  
  <pre><code>function afterSubmit_setASA(){
      var soItemCount = nlapiGetLineItemCount('item');
  
      for (var i = 1; i &lt;= soItemCount; ++i) {
          var lineamt = nlapiGetLineItemValue('item', 'amount', i);
  
          if (lineamt != null &amp;&amp; lineamt != '') {
              nlapiSetLineItemValue('item', 'altsalesamt', i, lineamt);
          }
      }
  }
  </code></pre>
  
  <p>Can anyone point me in the right direction of what I may need to change or do?  Any help is greatly appreciated!!</p>