Custom button run using Client and userEvent Script, this code not Runnig, Error occurs: function buttonClick not defined
/**
* @NApiVersion 2.0
* @NScriptType UserEventScript
*/
define([“N/ui/serverWidget”], function (serverWidget) {
// function showPassedValueFunc() {
// empId = empId;
// }
// function beforeLoad(context) {}
// function afterSubmit(context) {}
return {
beforeLoad: function (context) {
var form = context.form;
form.addButton({
id: “custpage_dsc_emp_history”,
label: “History”,
functionName: “buttonClick”,
});
},
//showPassedValueFunc: showPassedValueFunc,
};
});
/**
* @NApiVersion 2.0
* @NScriptType ClientScript
*/
define([], function () {
return {
buttonClick: function (context) {
var employee = context.currentRecord;
alert(“This is employee Data”, employee);
},
pageInit: function (context) {},
};
});