Shelby Owens
06/09/2025, 12:40 PMCeligo AI
06/09/2025, 12:41 PMAI generated answer (using internal Slack threads):To accomplish this, you can use a User Event script that triggers on the 'create' event type. This script will allow you to access the child records via sublist operations from the parent record and update the necessary fields. Here's a basic example of how you might structure this script:
javascript
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
*/
define(['N/record'], function(record) {
function beforeSubmit(context) {
if (context.type !== context.UserEventType.CREATE) {
return;
}
var parentRecord = context.newRecord;
var childSublistCount = parentRecord.getLineCount({sublistId: 'your_sublist_id'});
for (var i = 0; i < childSublistCount; i++) {
var childRecordId = parentRecord.getSublistValue({
sublistId: 'your_sublist_id',
fieldId: 'id',
line: i
});
var childRecord = record.load({
type: 'your_child_record_type',
id: childRecordId
});
childRecord.setValue({
fieldId: 'your_field_id',
value: 'your_value'
});
childRecord.save();
}
}
return {
beforeSubmit: beforeSubmit
};
});
In this script, replace 'your_sublist_id', 'your_child_record_type', 'your_field_id', and 'your_value' with your actual sublist ID, child record type, field ID, and value, respectively.
Please note that this script will only trigger when a new parent record is created. If you need to handle updates to existing records, you'll need to adjust the script to also trigger on the 'edit' event type.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
06/09/2025, 12:41 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.877729356
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.859285772
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.858680367
Celigo AI
06/09/2025, 12:41 PM