Modules

filter

 

Objects/Functions

module (N/util)

SuiteScript 2.0

util.each(iterable, callback)

{util}.each(iterable, callback){iterable: {Object | Array*},callback: {Function*}})

N/util Module
util.each(iterable, callback)
Method Description: Iterates over each member in an Object or Array. This method calls the callback function on each member of the iterable.
Returns: The original collection as an Object | Array
Supported Script Types: All script types For more information, see SuiteScript 2.0 Script Types.
Governance: None
Module: N/util Module
Since: 2016.1
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=util.each(iterable, callback)

Example:

// Code Example 1
//Add additional code
//...
// Iterate through the object and set the key-value pairs on the record
util.each(itemList, function(quantity, itemId){
rec.selectNewLine('item');
rec.setCurrentSublistValue('item','item',itemId);
rec.setCurrentSublistValue('item','quantity',quantity);
rec.commitLine('item');
});
//...
//Add additional code

//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4541697371.html