Nour Khaled
01/22/2025, 2:38 PMCeligo AI
01/22/2025, 2:38 PMAI 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. ****** The error you're encountering,
newSubRec.save is not a function
, is because the save
method is not used on the newRecord during beforeSubmit; it is already in the process of being saved.
Also, it's important to note that client script on subrecords is not supported in SuiteScript 2.0. You might be trying to use dynamic mode methods on a standard mode record. Instead, you should use setSublistValue
.
Here is a sample code snippet:
javascript
// Create the inventory detail subrecord.
var subrec = CurrentWOC.getSubrecord({
fieldId: 'inventorydetail'
});
// Set values on the subrecord's inventory assignment sublist.
subrec.setSublistValue({
sublistId: 'inventoryassignment',
fieldId: 'receiptinventorynumber',
line: 0,
value: tempSNAR
});
subrec.setSublistValue({
sublistId: 'inventoryassignment',
fieldId: 'quantity',
line: 0,
value: 1
});
Please note that the only way to edit sublist subrecords like Inventory Detail is in deferredDynamic / Standard mode. You can refer to the [Supported Deployments for Subrecord Scripting](https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4712495741.html) for more information.Celigo AI
01/22/2025, 2:38 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.860250354
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.854651451
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.850956321
Celigo AI
01/22/2025, 2:38 PM