RE: Activate SuiteCommerce Advanced Extension
When I tried to add a SuiteScript file in the SuiteScript2 folder, I am getting this error while activating the extension.
{“type”:”error.SuiteScriptError”,”name”:”14978″,”message”:”Invalid define call, define should only be called once per module. Define calls found at the following line numbers: tmp_ssp_libraries_ext.js 34, 69, 108, 136, 167, 205, 231, 262″,”stack”:[“createError(N/error)”],”cause”:{“message”:”Invalid define call, define should only be called once per module. Define calls found at the following line numbers: tmp_ssp_libraries_ext.js 34, 69, 108, 136, 167, 205, 231, 262″,”stack”:[“createError(N/error)”,”reduce(/SuiteBundles/Bundle 455185/ExtensionMechanism.Server/CompilersMapReduce/SspLibrariesCompilerMapReduce.js:295)”],”name”:”14978″},”id”:””,”notifyOff”:false,”userFacing”:true}
Here is my code:
I am reasonably sure that you are getting this error because you have attempted to call ‘ServiceController’ in your SS2 extension which is a core SCA module. Extensions SuiteScript 2 cannot call core SCA modules — only generic SuiteScript 2 modules or modules that you have already defined in the extension.
You are completely free to reimplement service controllers in your extension if you really wish, but the recommended approach is to use service files. See my example here: https://github.com/oracle-samples/netsuite-commerce/blob/master/samples/2020-2/Example-part10-final/Modules/UserPreferences/SuiteScript2/Example.UserPreferences.Service.ss