Using the exports external from the define module,...
# suitescript
d
Using the exports external from the define module, I can now call exports from the browser window. So exports.xyz will now execute the function as desired.
b
That looks like a global variable. If you refactor exports to abc, does it work the same
I was under the impression that line 2 would need to look like
define(['N/search', 'exports'], function(search, exports) {
to use amd's exports
d
var exports is a global. That's the only way I can find to call xyz.
j
Yeah it's not using amd's exports variable, just happens to have the same name. @dcrsmith wherever you are calling xyz, using
require(['/path/to/this/file'], function(mod) { <http://mod.xyz|mod.xyz>(); });
does not work?
d
I don't have the path to the file when I bundle it.
j
I see now. hence your experimenting with named modules
d
Yes. The buttons are created in a saved search. So now my formula in the search is something like this: onclick="exports.xyz( <some id> )"
This seems to work well
j
Yea seems good enough. I might want to rename exports to something a bit less likely to collide with the tons of client code NetSuite already has on the page though
d
I did. The example here was just that, an example.
j
nice 👍
d
Thanks for the help and the sounding board.
🍻 1