<@U8X7E86M6>: This is in reference to your article...
# suitecommerce
v
@Steve Goldberg: This is in reference to your article - https://developers.suitecommerce.com/add-custom-entity-field-data-to-the-profile-model Can something similar be done for other Backend Models - ex Case.Model . I get an error missing Case.Model when I try to access it in one of suitescripts files. Just wanted to check if I’m missing something and it is possible to achieve this within extension code.
s
Well this example relies on the Commerce API, so you couldn't use that to fetch any custom fields for your cases. As for cases, you could certainly change the fields it fetches for sure.
What version of SCA are you running?
v
20.1 . But when I used Case.Model within define , it gives an error - Case.Model is missing.
s
And are you trying to reference it in an extension?
v
yes
under Suitescript folder
s
That is why. We have begun migrating some modules to SuiteScript 2.0 and TypeScript and that is one of them.
Essentially, it means that at things currently are you cannot include them in your extensions as they are not referenceable.
v
Advanced/Case/SuiteScript/Case.Model.js — Oh ! Is there a workaround that you’d recommend ?
s
You have three options: 1. Find another way to do your customisation 2. Include your customisation as part of the core code customisations, which requires you to do some TypeScript 3. Revert the case modules to their SuiteScript 1.0 versions
For example, some people use a separate service call to fetch custom fields for cases
v
Thanks @Steve Goldberg, So its either fig out some custom process vs using File Override Approach ( required for both 2 & 3rd point )
s
Neither requires file overrides, no.
v
1. Include your customisation as part of the core code customisations, which requires you to do some TypeScript For this I’ll need to create a folder within native Advance folder, won’t I ?
s
It should be possible to do number 2 as a 'traditional' customisation, where you to intercept the call to the cases service and tell it to include additional fields. But I've not done that
It doesn't have to be within Advanced but it could be a sibling to it
v
Is there a document link to something similar that I can reference ? Sorry for bothering you , but I haven’t used Typescript much specially within NetSuite context
s
I've not written a customisation for existing SS 2.0 / TypeScript modules so I can't really offer advice on the specifics. And no, I don't think there is, sadly.
v
😞 nevermind, thanks a lot for you time and advice
Just 1 last thing, so you think its possible but not within Extension code, For this I’ll need the older approach (changes in distro after adding code - referencing the core code — just like patches ) - I haven’t really used older approach ever so just wanted to confirm that once with you before exploring more on this
s
No worries. I don't know what exactly you're trying to do but the advice I have from the dev team is that while things are in a transitional state, it will probably be easier to run your customisation in parallel with our code. So, for example, if you want to capture extra data in your cases form, then split out the data so that the additional data is sent in a secondary service call.
v
yeah but when I want to save that info , I’ll need to wait for standard call to complete first and then update that record with custom information.
s
Indeed. I am not sure how feasible it is as I've not done it
You mentioned file overrides, that can also be a way of doing it. Eg, make a copy of the existing cases functionality, make your changes, and then tell the distro to include that rather than the existing one
But I'm not sure how good that will be going forward (ie it will require maintenance with each release)
v
🙂 thanks for your active and quick response though . I wasn’t expecting a quick reply. I think I can make it work with some customisation but just wanted an expert advice . You’re right about File Override - I didn’t feel easy about it considering we have to then keep track of all the core files in repository moving forward and keep track of changes over every release.
netsuite halo 1