I am working on an Assistant Suitelet. I keep gett...
# suitescript
j
I am working on an Assistant Suitelet. I keep getting the error: "warrField.updateDisplayType is not a function" but I see that updateDisplayType works on Suitelets. Code snippet below. What am I doing wrong?
Copy code
let warrField = assistant.addField({
                id: 'warrantyid2',
                type: sw.FieldType.TEXT,
                label: 'Warranty ID'
            }).defaultValue = params.warrantyid

            warrField.updateDisplayType({
                displayType: sw.FieldDisplayType.HIDDEN
            })
b
you are using Field.defaultValue wrong
j
That part works, though.
It shows me the correct defaultValue needed there. I just need to hide it as I'm passing param contexts between assistant stages.
b
still using it wrong
just because its setting the default value doesnt mean you using it correctly
d
just separate
warrField.defaultValue = params.warrantyid
to a separate line
j
@dbarnett That worked. Thank you!
g
@JessicaL using type information, most IDEs would have told you that you were assigning invalid type to
warrField
jsdoc is the low hanging fruit for you to get that since netsuite ships definitions for the N/ api
s
TypeScript for the win!
d
in which case would highly recommend using https://github.com/headintheclouddev/typings-suitescript-2.0 (does not necessarily require TS if you're not using that, can be setup for JS as well)
s
☝️this is the de-facto canonical type declarations for SuiteScript
g
FTR, i agree about TS and the hitc types. most should be thinking about getting there. for those not there yet, simple jsdoc can help you today
a
They day JS loses the beauty of being not hard typed, the beauty of being chaotic that day I would switch to another language.
s
chaos = job security?
a
No, it is about colors, we have many because not everybody like the same colors, I would never develop using an indented language for example, the same way I don’t like the idea of JS being hard typed, there are plenty of hard typed languages out there. I don’t see how chaos could be possible translated to job security btw…
g
never say never but yeah, i hear ya. the job security will come by working in whatever your passionate about and it leaves pretty much the minute you are wored about job security
s
That's one thing I like about TS and is a bit unique - you get a lot of flexibility in just how much you want to leverage the type system. chaos = job security is partially joking, but I have seen horribly complex spaghetti code that only the original developer understands - if only they can change it that's an unfortunate form of job security.
a
@Shawn Talbert Spaghetti code is easily handle with defined coding standards and code reviews. People write spaghetti code even with hard typed languages.
s
agreed, a strong type system is no automatic guarantee of quality!
a
Developers are notorious for having big egos, what most don’t realize is spaghetti code does not make you a good developer, readable and maintainable code does in my book.
💯 1