Shelby Owens
10/09/2025, 2:38 PMCeligo AI
10/09/2025, 2:38 PMAI generated answer (using internal Slack threads):To prepopulate a field on a custom sublist from a field on the case record when a new line is created, you can use a client script. Here's a general approach: 1. In your client script, you will need to use the
pageInit function. This function is triggered every time the page is loaded or a new line is added to a sublist.
2. Inside the pageInit function, you can use the currentRecord object to get the value of the field from the case record that you want to use to prepopulate the sublist field.
3. Then, you can use the setCurrentSublistValue method to set the value of the sublist field.
Here's a sample code snippet:
javascript
/**
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
define(['N/currentRecord'], function(currentRecord) {
function pageInit(scriptContext) {
if (scriptContext.mode !== 'create') {
return;
}
var caseRecord = currentRecord.get();
var caseFieldValue = caseRecord.getValue({fieldId: 'your_case_field_id'});
caseRecord.setCurrentSublistValue({
sublistId: 'your_sublist_id',
fieldId: 'your_sublist_field_id',
value: caseFieldValue
});
}
return {
pageInit: pageInit
};
});
Please replace 'your_case_field_id', 'your_sublist_id', and 'your_sublist_field_id' with your actual field and sublist IDs.
******
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
10/09/2025, 2:38 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.865234375
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.859436095
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.855346739
Celigo AI
10/09/2025, 2:38 PM