```mySearch.run() .getRange(...) .forEach(func...
# suitescript
e
Copy code
mySearch.run()
  .getRange(...)
  .forEach(function (result) {
    var itemId = result[i].getValue({ name: 'custrecord255' });
    rec.selectNewLine({ sublistId: 'item'})
      .setCurrentSublistValue({  
        sublistId: 'item',
        fieldId: 'item',
        value: itemId,  
        forceSyncSourcing: true
      })
      .commitLine({"sublistId": "item"});       
  });
p
@erictgrubaugh I tried the above but in console I keep getting either a
Cannot read property 'getValue' of undefined
error or if I change the function name to results I get a
Cannot read property '1' of undefined
error. Not sure what I am missing.
e
Just a copy-paste error; you don't need the
[i]
anymore because there is no
i
and
result
is no longer an array