GSWes
04/07/2021, 7:08 PMfunction handleBeforeLoad(context) {
if (context.type != 'view') { return false; }
enums.buttonArray.forEach(button => {
context.form.addButton(button);
})
context.form.clientScriptModulePath = "SuiteScripts/sr_custom_button_press_cl.js";
}
Here’s the enum.js
define([], function () {
const exports = {}
const buttonArray = [
{
id: 'custpage_btn_spcl',
label: 'Special',
functionName: "greet"
},
{
id: 'custpage_btn_ord',
label: 'Ordinary',
functionName: "greet"
}
]
exports.buttonArray = buttonArray
return exports
});
Here’s the function that is supposed to run when either of the two buttons are pressed.
define([], function () {
/**
* @NApiVersion 2.x
* @author Wes
*/
var exports = {};
function greet() {
log.debug('My Greeting', 'Hello world')
console.log('Hello world');
alert('Hello world')
}
exports.greet = greet;
return exports;
});
Eric B
04/07/2021, 7:23 PMGSWes
04/07/2021, 7:24 PMdefine(['./enums'], function (enums) {
Sandii
04/07/2021, 7:26 PMGSWes
04/07/2021, 7:26 PMSandii
04/07/2021, 7:27 PMGSWes
04/07/2021, 7:31 PMGSWes
04/07/2021, 7:36 PMSandii
04/07/2021, 7:39 PMfunctionName: "greet()"
Sandii
04/07/2021, 7:40 PMlog.debug()
from your client since it's not deployed and just stick with console/alertGSWes
04/07/2021, 7:48 PMSandii
04/07/2021, 7:49 PMbattk
04/07/2021, 11:00 PMgeorge085
04/07/2021, 11:00 PM/**
* @NApiVersion 2.x
* @author Wes
*/
on top of the scriptbattk
04/07/2021, 11:00 PM