Si Hobbs
02/21/2025, 5:29 AMCeligo AI
02/21/2025, 5:29 AMAI generated answer (using internal Slack threads):****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To create a record and set multiple fields in an API efficient way, you can use the
N/record
module in SuiteScript 2.0. However, there is no set-based API for creating multiple instances of a custom record type at a time, in any version of SuiteScript.
If you have a large volume of data, such as more than 10,000 lines, creating records using record.create
and record.save
can be time-consuming and consume a lot of API governance.
One workaround is to use a Map/Reduce script to spread the record creates out over several parallel Map phases. This is particularly useful if you have a SuiteCloud Plus license, but it can still be beneficial even if you don't.
Another option is to use parent-child relationships to perform mass creates. This is outlined in section 2.3.4 Using Parent-Child Relationships to Perform Mass Create/Update
of the SuiteAnswers Full Access (SAFE) guide.
Here is a sample code snippet for creating a record and setting multiple fields:
javascript
var fieldsToGet = {
field1: null,
field2: null,
field3: null,
field4: null,
field5: null,
field6: null,
field7: null,
}
for (var fieldId in fieldsToGet){
fieldsToGet[fieldId] = originalRec.getValue(fieldId);
}
for (var fieldId2 in fieldsToGet){
newRec.setValue(fieldId2, fieldsToGet[fieldId2]);
}
Please note that this is just a sample and you would need to adjust it according to your specific needs.Celigo AI
02/21/2025, 5:29 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.820328057
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.81480366
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.805463254
Celigo AI
02/21/2025, 5:29 AM