Hi, i have tried to use suite script 2.1 in user e...
# suitescript
d
Hi, i have tried to use suite script 2.1 in user event script, script works fine, but i am new to ES6, if any one can review this script and can guide me using es6 in better way, appreciate it
m
In ES6
var
is basically just for backwards compatibility and you should use
let
or
const
instead
👍 1
✔️ 1
b
although not really related to 2.1, you should have 2 scripts
one for customrecord_service_window_cus, one for customers
d
@battk any advantage if i seperate it?
b
performance, you wont be running unnecessary code on unrelated records
✔️ 1
modularity, dont group unrelated code together
💯 1
using the filtering options on the script deployment would mean your script wouldnt even run
💯 1
another non 2.1 related suggestion: combine the code on lines 118-147. The code to change address sublist into an object is the same for the old record and the new record
✔️ 2
🔥 1