Team, I am writing a GL Plugin in Suitescript 1.0 and I would like to organize the code in submodules or libraries. I would like to have a library with the logic for invoices, one for credit memos, etc. In SuiteScript 2.0 I normally create a separate file and I include it in the define section like other modules. Do you know how I could accomplish this in SS 1.0?
s
scottvonduhn
03/11/2022, 4:35 PM
It’s somewhat limiting, due to the nature of SS 1.0 and JavaScript 5.1, but here is how we have ours organized:
For each transaction type, we have a very small entry point GL plug-in script (which implements the customizeGlImpact entry point function), but then delegates most of the work to a JavaScript 1.0 library module
You then just need to add that module as a Library to the GL Plug-in implementation. You can put any shared logic and code in the module, and have each implementation simply perform high level checks to see if it should run or not, then it can call the process function, or any other exported functions from your module.
scottvonduhn
03/11/2022, 6:06 PM
Because of how SS 1.0 works, the module is defined as a global variable so it’s not truly being imported, therefore be careful of what name you use for the module. It needs to be unique enough not to conflict with anything else.