I have 2 records setup for parent child relationsh...
# ask-stanley-ai
t
I have 2 records setup for parent child relationship in netsuite, with child record editing enabled, menaing the child record is available as sublist. Does it cost me governance to create the child records as well? or just the parent record? And If I remove the lines from it, save it and delete it, would it better than delete all child record separately.
c
AI generated answer (using internal Slack threads):
In NetSuite, when you have a parent-child relationship between two custom records, the child records can be treated as line items of the parent record. This is possible when you load the parent record in dynamic mode, select a new line, set the child details, commit the line, and then save the parent record after you've added all children. The governance for adding sublist lines is 0, meaning it does not cost you any governance units to create the child records. The sublist is usually named something like
recmachcustrecord_<restoftheid>
. You can find the internal ID of the custom child record sublist in the NetSuite help documentation. Here is a sample code snippet for adding child records:
Copy code
javascript
var record = nlapiLoadRecord("customrecord_gc_rhenus_stock_rec_results", recID);
for(var i = 0, len = variances.length; i < len; i ++) {
    record.selectNewLineItem('rechmachcustrecord_gc_rhenus_stock_rec_parent');
    record.setCurrentLineItemValue('customrecord_gc_rhenus_recon_res_line', 'custrecord_gc_rhenus_stock_rec_sku', variances[i]['sku']);
    record.commitLineItem('rechmachcustrecord_gc_rhenus_stock_rec_parent');
}
nlapiSubmitRecord(record, true);
If you want to make the sublist editable, you need to check the "Allow child record editing" checkbox on the child record. This will allow users to add and modify line items directly on the form. As for deleting the child records, if you remove the lines from the parent record and save it, it will delete the child records associated with those lines. This is more efficient than deleting each child record separately. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.855041564
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840270877
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837890625
Please provide your feedback on this answer.
Thank you for your feedback