/**
* @NApiVersion 2.1
* @NScriptType UserEventScript
*/
/***********************************************************************************************************
* Chesapeake Coffee Roasters-USA-NS/SCA
*
* CCRUN-8 Custom Print Button for Bank Deposit Summary with Advanced PDF/HTML Template
*
*****************************************************************************************
* Author : Jobin & Jismi
*
* Date Created : 15-October-2024
*
* Description : This User event script is for PDF customization of Bank deposit
*
* REVISION HISTORY
*
* Version 1.0 : 15-October-2024 : Created the initial build by JJ0325
*
************************************************************************************/
define(['N/record',],
/**
* @param{record} record
* @param{serverWidget} serverWidget
*/
(record) => {
/**
* Defines the function definition that is executed before record is loaded.
* @param {Object} scriptContext
* @param {Record} scriptContext.newRecord - New record
* @param {string} scriptContext.type - Trigger type; use values from the context.UserEventType enum
* @param {Form} scriptContext.form - Current form
* @param {ServletRequest} scriptContext.request - HTTP request information sent from the browser for a client action only.
* @since 2015.2
*/
const beforeLoad = (scriptContext) => {
try{
if(scriptContext.type =='view' ){
log.debug('current form is',scriptContext.form);
scriptContext.form.addButton({
id: "custpage_jj_print_pdf",
label: "Print",
functionName: 'printDeposit'
});
scriptContext.form.clientScriptFileId = 2584
log.debug('new Record is',scriptContext.newRecord);
}else{
log.debug('type not view');
return true;
}
}catch(e){
log.error('error in beforeload',e)
}
}
return {beforeLoad}
});