Boris
09/02/2025, 1:18 PMCeligo AI
09/02/2025, 1:18 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems that you can use a client script to set fields in the
pageInit
function. This function is executed after the page is initialized. Here is an example of how you can do this:
javascript
/**
* @NApiVersion 2.1
* @NScriptType ClientScript
* @NModuleScope SameAccount
*/
define([
'N/record',
'N/ui/message',
'N/ui/dialog',
'N/log',
// other modules
],
function(Nrecord, NuiMessage, NuiDialog, Nlog, /* other modules */) {
/**
* Function to be executed after page is initialized.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.currentRecord - Current form record
* @param {string} scriptContext.mode - The mode in which the record is being accessed (create, copy, or edit)
*
* @since 2015.2
*/
const pageInit = (scriptContext) => {
console.log('foo');
alert('foo');
Nlog.debug({
title: 'pageInit',
details: 'pageInit'
});
// other operations
}
return {
pageInit: pageInit,
};
});
In this example, the pageInit
function is defined and then returned as part of the module's public API. This function will be executed when the page is initialized. You can add your logic to set fields inside this function.
Please note that client scripts only work in Edit mode, not in View mode. If you want to do some DOM manipulation when viewing a record, you can use a beforeLoad
UserEvent script that adds an inlinehtml field, then put the DOM manipulation code in that 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
09/02/2025, 1:19 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.849280357
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.841536105
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840746582
Celigo AI
09/02/2025, 1:19 PM