LRG
11/12/2020, 3:42 PMform.addButton({
id: 'custpage_add_printbtnpack',
label: 'Print Delivery Note',
functionName: 'printDeliveryNote('+scriptContext.newRecord.id+')'
});
ericbirdsall
11/12/2020, 3:47 PMLRG
11/12/2020, 3:48 PMLRG
11/12/2020, 3:48 PMericbirdsall
11/12/2020, 3:49 PMvar sales_order_id = record.getValue({
fieldId: 'createdfrom'
});
var fieldLookUp = search.lookupFields({
type: search.Type.SALES_ORDER,
id: sales_order_id,
columns: 'custbody_checktrue' // whatever the field ID is
});
ericbirdsall
11/12/2020, 3:49 PMLRG
11/12/2020, 3:50 PMericbirdsall
11/12/2020, 3:50 PMericbirdsall
11/12/2020, 3:52 PMLRG
11/12/2020, 3:53 PMLRG
11/12/2020, 3:53 PMericbirdsall
11/12/2020, 3:56 PMcreece
11/12/2020, 3:57 PMLRG
11/12/2020, 3:57 PMericbirdsall
11/12/2020, 3:58 PMLRG
11/12/2020, 3:59 PMLRG
11/12/2020, 4:46 PMdefine(['N/record', 'N/log','N/runtime','N/currentRecord'],
function(record, log, runtime,currentRecord) { ...
LRG
11/12/2020, 4:47 PMcreece
11/12/2020, 4:47 PMcreece
11/12/2020, 4:47 PMLRG
11/12/2020, 4:49 PM/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
* @NModuleScope SameAccount
*/
define(['N/record', 'N/log','N/runtime','N/currentRecord'],
function(record, log, runtime,currentRecord) {
/**
* Function definition to be triggered before record is loaded.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.newRecord - New record
* @param {string} scriptContext.type - Trigger type
* @param {Form} scriptContext.form - Current form
* @Since 2015.2
*/
function beforeLoad(scriptContext) {
if (scriptContext.type == 'view') {
var form = scriptContext.form ;
log.audit('ItemFulFillmentId' ,scriptContext.newRecord.id);
var scriptObj = runtime.getCurrentScript();
log.debug("Script parameter: " + scriptObj.getParameter({name: 'custscript_ax_clientscriptcertificateid'}));
form.clientScriptFileId = scriptObj.getParameter({name: 'custscript_ax_clientscriptcertificateid'});
form.addButton({
id: 'custpage_add_printbtn',
label: 'Print Certificate Of Conformity',
functionName: 'printCertificate('+scriptContext.newRecord.id+')'
});
var salesOrderId = record.getValue({
fieldId: "createdfrom"
});
/* var fieldLookUp = search.lookupFields({
type: search.Type.SALES_ORDER,
id: sales_order_id,
columns: 'custbody_checktrue' // whatever the field ID is
});
*/
form.addButton({
id: 'custpage_add_printbtnpack',
label: 'Print Delivery Note',
functionName: 'printDeliveryNote('+scriptContext.newRecord.id+')'
});
}else{
log.audit({title : "ContextType",details : "ContextType:" + scriptContext.type });
}
}
return {
beforeLoad: beforeLoad
};
});
LRG
11/12/2020, 4:49 PMcreece
11/12/2020, 4:50 PMvar salesOrderId = record.getValue({
fieldId: "createdfrom"
});
creece
11/12/2020, 4:50 PMericbirdsall
11/12/2020, 4:51 PMvar salesOrderId = scriptContext.newRecord.getValue({
fieldId: "createdfrom"
});
creece
11/12/2020, 4:51 PMLRG
11/12/2020, 4:51 PMLRG
11/12/2020, 4:52 PMLRG
11/12/2020, 5:21 PMvar salesOrderId = scriptContext.newRecord.getValue({
fieldId: "createdfrom"
});
var fieldLookUp = search.lookupFields({
type: search.Type.SALES_ORDER,
id: salesOrderId,
columns: 'custbody_bxt_downpayment_val' // whatever the field ID is
});
form.addButton({
id: 'custpage_add_printbtnpack',
label: fieldLookUp,
functionName: 'printDeliveryNote('+scriptContext.newRecord.id+')'
});
creece
11/12/2020, 5:57 PMLRG
11/12/2020, 5:58 PM