Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
How to make a button actually do something
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.
0