I keep getting this error, while trying to use run...
# suitescript
r
I keep getting this error, while trying to use runtime module in suitelet script 2.1 Fail to evaluate script: {"type":"error.SuiteScriptError","name":"SUITESCRIPT_API_UNAVAILABLE_IN_DEFINE","message":"All SuiteScript API Modules are unavailable while executing your define callback.","id":"","stack":["Error\n at /SuiteScripts/x_sl.js5613"],"cause":{"type":"internal error","code":"SUITESCRIPT_API_UNAVAILABLE_IN_DEFINE","details":"All SuiteScript API Modules are unavailable while executing your define callback.","userEvent":null,"stackTrace":["Error\n at /SuiteScripts/x_sl.js5613"],"notifyOff":false},"notifyOff":false,"userFacing":true}
n
Share your code... probably just need to see the top section with the JSdocs and down to the function start.
r
It was for a way noobish reason then what you suggested xD
n
🤣 Maybe share what?
t
@NElliott I also had this error before, basically if you try to do const outside of the main functions but call runtime.. let say you want to get the environment - sb/prod because you need to hardcode some stuff if you use copy and paste to update your script say via file cabinet, it'll block you and tell you you cant do it but it actually works if you use sdf to push, you can bypass it
👍🏻 1
n
...which is why I wanted to see the first block of code 😄 (not me with the issue 😉 )
👍 1
t
dang you were spot on.. take a like