I challenged one of my developers to do his next project in SS2.0.
He wants to put a button on a page (in this case Work Orders) and trigger a simple JavaScript action when somebody clicks on it.
He's using a User Event Script to place the button, like so:
/** * @NApiVersion 2.x * @NScriptType UserEventScript */ define(['N/log'], function(log) { function beforeLoad(context) { var button = context.form.addButton({ id: "custpage_nb_test_button", label: "Test Button", functionName: "testFunctionOne" }); log.debug("button info", button); } return { beforeLoad: beforeLoad }; }); What we are confused by is that we don't know how to put a function called "testFunctionOne" into the Global namespace on the Work Order form.We tried writing a 2.0 Client Script with a function called "testFunctionOne", but it appears in a different namespace and can't be called by the button click.Any pointers?