Being that client scripts can't run in 2.1, is it ...
# suitescript
a
Being that client scripts can't run in 2.1, is it an issue to attach a 2.0 client script to a 2.1 suitelet?
b
Shouldn’t be an issue. But you run client scripts in 2.1. Just need to add an empty pageInit function for it to work.
a
Oh, so client scripts are now officially supported in 2.1? I accidentally set a client script to 2.1 yesterday, and I wasn't able to get the context (parameters) of the fieldChanged until I changed it to 2.0, but I didn't make an empty page init
b
I recently started using 2.1 myself
s
Client scripts are supposed to support SS2.1 as of NS 2021.1
a
@stalbert So any reason you know of that I wouldn't get the context when using 2.1? Is it because I was supposed to have an empty page init?
s
sounds like either a bug in your code or a bug in NS
you should probably share your code here if you want a more detailed response
w
The code that calls the client script is bugged and passes through using the SS1 style. Try using the following:
Copy code
fieldChanged : (sublistId, fieldId, line) => {//your code here}
s
is that a recent bug? sounds like it would be a high priority one as it would break any 2.1 client scripts
☝️ 1
d
@Azi or anyone else on this thread, was there ever a resolution for this? I am seeing the same behavior in an account now as well
w
The only solution was to work-around the issue by adding those parameters into your SS2.1 suitelet client script. It might be an idea to work defensibly and check for the types passed into your function, so that it won't break if they ever fix the issue.
d
did you see something similar with
pageInit
as well?
I tried adding other parameters hoping
context.currentRecord
might be added as similar additional argument, but seems like is only sending what would normally be context.mode
w
Yes, the parameters are getting passed in the same as SS1 client scripts https://netsuite.custhelp.com/app/answers/detail/a_id/10579/kw/Client%20Event%20Types
s
SS1 was arguably more sane in some ways, IMHO 🙂
d
@Webber @stalbert idk if this is known already, but just fyi, this appears to be reason why 2.1 script is behaving this way: seems NS client script 2.1 is not "supported" in this sense until they update their condition/bug
also, putting a breakpoint at bottom highlighted section is a handy way to get into any client-side script entry points without having to put
debugger
statement if is locked etc. 🙂
s
isn't this a regression? I have done some [client] scripting in 2.1 and it worked fine a while back.
d
@stalbert not sure honestly, this is my first attempt at client 2.1 (specifically that which is attached to a Suitelet) maybe if you still have an example in whatever account, you could debug same NS src and see why yours actually works if so? I'd be curious the difference, maybe some of my NS src is cached or something weird
s
mine definitely wasn't attached to a suitelet or form so maybe therein lies the difference?
👍 1
d
@Webber @stalbert so I just got off the line with NetSuite Support to explain the issue, they did acknowledge it and is already Defect#635679 , but unfortunately it is only U7 so no ETA on when would be fixed 😞 for anyone else who has same issue and is more of a big deal for them, I would encourage to also file support ticket referencing Defect# , maybe we can collectively get bumped to higher severity
s
Wow, that's a pretty serious fault in the system for a U7
a
I'm glad I wasn't the crazy one here
I thought I completely missed the boat and started watching beginner videos on Netsuite
d
yah I guess maybe since isn't a regression if was never working is the rationale? I am not happy about it either, since we use a lot of helper modules (where we'd like to use shared ES6 syntax etc.) this prevents us from going to 2.1 across the board. also just fyi, changing the Company general Preference "EXECUTE SUITESCRIPT 2.X SERVER SCRIPTS AS" to 2.1 did not resolve either