Rick Goodrow
05/31/2024, 8:49 PMpageInit
& validatefield
entry points.
• Script is deployed to a custom record in NS to all Roles
• Both Script record & Deployment record are both in Testing/Debug mode,
• Scripted Records shows the client script being attached to the custom record
However when I load the custom record, the pageInit
function is not firing and for the life of me I cannot figure out why. Does anyone know some pitfalls I can check to figure out why it's not firing?Edgar Valdes
05/31/2024, 8:55 PMpageInit
?Rick Goodrow
05/31/2024, 8:59 PMconst pageInit = (scriptContext) => {
console.log('foo');
alert('foo');
Nlog.debug({
title: 'pageInit',
details: 'pageInit'
});
}
battk
05/31/2024, 9:02 PMRick Goodrow
05/31/2024, 9:16 PMRick Goodrow
05/31/2024, 9:16 PMbattk
05/31/2024, 9:22 PMbattk
05/31/2024, 9:23 PMbattk
05/31/2024, 9:23 PMRick Goodrow
05/31/2024, 9:27 PM/**
* @NApiVersion 2.1
* @NScriptType ClientScript
* @NModuleScope SameAccount
* @author Rick Goodrow <rickg@unikavaev.com>
*/
define([
'N/record',
'N/ui/message',
'N/ui/dialog',
'N/log',
'SuiteScripts/unika_vaev/lib/uv_lib_id',
'SuiteScripts/unika_vaev/lib/uv_lib_common_client',
'SuiteScripts/unika_vaev/hni_shipments/uv_lib_hni_shipment',
],
/**
* @param {record} Nrecord
* @param {message} NuiMessage
* @param {dialog} NuiDialog
* @param {log} Nlog
* @param {object} uv_lib_id
* @param {object} uv_lib_common_client
*/
function(Nrecord, NuiMessage, NuiDialog, Nlog, uv_lib_id, uv_lib_common_client) {
let linkedFulfillmentsOriginalValue = null;
/**
* 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'
});
// uv_lib_common_client.addStyleSheets();
// Nlog.debug({
// title: 'styleSheetsAdded',
// details: 'styleSheetsAdded'
// });
// uv_lib_common_client.updateState();
// set placeholder value on page init so we know what value to fall back to
// linkedFulfillmentsOriginalValue = scriptContext.currentRecord.getValue({
// fieldId: uv_lib_hni_shipment.ref.record.HNI_SHIPMENT.field.SHIPMENT_FULFILLMENTS,
// });
}
return {
pageInit: pageInit,
};
});
rustyshackles
05/31/2024, 9:34 PMwhen I load the custom record
. You might be loading it in view mode.Rick Goodrow
05/31/2024, 9:36 PMrustyshackles
05/31/2024, 9:40 PMbattk
05/31/2024, 9:42 PMrustyshackles
05/31/2024, 9:43 PMclientScript
it would only execute on edit modeRick Goodrow
05/31/2024, 9:43 PMRick Goodrow
05/31/2024, 9:44 PMrustyshackles
05/31/2024, 9:45 PMRick Goodrow
06/05/2024, 4:35 PM