I'd recommend you use the code snippet I pasted ab...
# suitescript
s
I'd recommend you use the code snippet I pasted above - convert it to plain Suitescript if you must but it's a proven solution