Hey, Can anyone provide a code to insert multiple ...
# suitescript
m
Hey, Can anyone provide a code to insert multiple records in a customrecord in SS2.0? Or the only solution is to save the data using loop var rec = nRecord.create({ type: 'customrecord_recordname', isDynamic: false }); rec.save(); Can anyone suggest a solution ?
b
i would choose the looped record.create and save
the alternative is to use a parent child relationship to create a parent record and fill up the child sublist
m
OK @battk but the issue is I have more that 2000 line of records that needs to be inserted to the custom record
b
i still vote to use the normal record creation process if points are not a concern
m
But in this case we reach to governance limit so I dont know how can I bypass this
s
Unfortunately, there is no set-based API for creating multiple instances of a custom record type at a time, in any version of SuiteScript. The best option I know of, particularly if you have a SuiteCloud Plus license or two (though still good even if you don't), is to use a Map/Reduce script to spread the record creates out over several parallel Map phases.
b
if points are an issue, then solution outlined in section
2.3.4 Using Parent-Child Relationships to Perform Mass Create/Update
of the SAFE guide is an option. https://netsuite.custhelp.com/app/answers/detail/a_id/46388