Quick question, is there any way we can override a...
# suitecommerce
e
Quick question, is there any way we can override a suitescript file (service controller) on 2020.1? I know this is not a best practice at all, we have been asked to delete a specific portion of code from
CheckoutEnvironment.ServiceController.js
, I have created the modules like we used to do in older versions, however whenever I try to deploy it, I get an error stating that the
CheckoutEnvironment.ServiceController.ts
(typescript file) does not exist. All this work is just to figure out if we can improve performance.
s
You're using the standard override mechanism in your ns.package.json and including the new file in the distro?
If you want to override a method, then you should just be able to do that in your SuiteScript file
And yeah, it's not good practice 🙂
netsuite 1
e
Yes, I am doing exactly that. Actually the same steps described on this article for patches: https://netsuite.custhelp.com/app/answers/detail/a_id/95743
The steps are correct however I am not sure where on the gulp tasks is declared to expect .ts files for suitescript files.
s
OK. Just to check -- is it saying it can't find the file you're trying to override?
e
correct! ENOENT: no such file or directory, and when I change the extension file from .js to .ts I got a different error, so I am not sure how to tackle this issue
s
Hold on -- I'm confused. You're trying to replace code in CheckoutEnvironment.ServiceController.js? This is a JS file -- why are you trying to override a TS file?
Surely the reason why it can't find the file is because that file doesn't exist ... and you should be overriding the JS file?
e
Yeah, I mean, I am overriding
CheckoutEnvironment.ServiceController.js
, however when I run`gulp deploy --to` I got
ENONT: ....
but the error is stating CheckoutEnvironment.ServiceController.ts is not found (I do not know from where it is expecting or taking the .ts) I have named with .js my file, then I tried to renamed just for testing using the .ts but it did not work (as expected)
s
Can you post in the value for the overrides property?
e
Sure, here is the structure of my custom module, it is located inside the
SuiteCommerce Advanced 2020.1/SC_20.1_Live/Advanced
Here my
ns.package.json
{
    
"gulp": {
        
"ssp-libraries": [
            
"SuiteScript/*.js"
        
]
    
},
    
"overrides": {
        
"Advanced/CheckoutApplication/SuiteScript/CheckoutEnvironment.ServiceController.js" : "SuiteScript/CheckoutEnvironment.ServiceController.js"
    
}
    
}
then in the distro I have the following line added:
"../Advanced/Extensions/XX_CheckoutApplication"
XX is just to hide the real abbreviation used in my folder
s
I'm sorry, I don't really have an answer. I reached out to a dev but no response yet
e
Do not worry @Steve Goldberg I appreciate your help! , in case you get an answer or something useful please share it here.
s
I have followed up on this and it appears there is a bug with the deploy mechanism for these types of overrides, which was fixed in 20.2
e
Perfect! Thanks so much @Steve Goldberg It makes sense! I will try to follow the steps during the week!
Hey @Steve Goldberg quick update here, after trying to apply this patch and deploy my override file, I got a new error but I think this is related to the suitescript changes from 2.0 to 2.1, I do not know exactly why, where or how but the description seems to me that the deploy is trying to change something in some file related to the JSDOC.
message has been deleted
s
What SuiteScript changes to 2.1? You cannot use 2.1 in SuiteCommerce -- have you tried changing the version used in the file?
e
I thought it might be related to S.S 2.1 in the backend of the NetSuite environments, I mean it might, however I tried deploying again without the patch and got the same error, so the root is not the patch. I am trying with another SSP to see if something else was changed on the customer environment.