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.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
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