<@U40LXUJ75> I do a very similar thing using this ...
# suitescript
e
@rgoodrow I do a very similar thing using this pattern:

https://www.youtube.com/watch?v=ltJhNSCWAE8

TLDW is something like:
Copy code
define([], function () {
  const functionRouter = {
    "doAThing": oneFunction,
    "doAnotherThing": anotherFunction,
    "thatOtherThing": yetAnotherFn
  }

  function oneFunction(context) { ... }
  function anotherFunction(context) { ... }
  function yetAnotherFn(context) { ... }

  return {
    post: function (context) {
        try {
            (functionRouter[context.action])(context);
        } catch (e) {
            onError(context);
        }
  }
});
untested of course, and I never write my entry point functions within the return statement, but that s/b pretty close to what you're trying
👍 3