Ajith Kumaran
03/28/2025, 7:14 AMCeligo AI
03/28/2025, 7:15 AMAI generated answer (using internal Slack threads):In NetSuite, you can achieve this by using a client script. The script will be triggered when you click the "+" sign next to the "Child Record Reference" field in the "Parent Record". The script will then auto-populate the "Parent Record Ref" field in the "Child Record" with the "Parent Record" record. Here is a sample script:
javascript
/**
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
define(['N/currentRecord'], function(currentRecord) {
function pageInit(scriptContext) {
var rec = scriptContext.currentRecord;
var parentRecordId = rec.id;
var childRecord = rec.getSublistValue({
sublistId: 'childrecord',
fieldId: 'parentrecordref',
line: 0
});
if (!childRecord) {
rec.setSublistValue({
sublistId: 'childrecord',
fieldId: 'parentrecordref',
line: 0,
value: parentRecordId
});
}
}
return {
pageInit: pageInit
};
});
This script uses the N/currentRecord
module to get the current record (the "Parent Record"). It then gets the "Parent Record Ref" field from the "Child Record" sublist. If the field is empty, it sets the field to the ID of the "Parent Record".
Please note that you need to replace 'childrecord' and 'parentrecordref' with the actual IDs of your sublist and field.
******
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
03/28/2025, 7:16 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.857081532
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.843843043
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83891
Celigo AI
03/28/2025, 7:16 AM