Hey! I have a strange issue where I have a self ex...
# suitescript
n
Hey! I have a strange issue where I have a self executing function that works fine in a Scheduled script, but when I move the function to a custom module, that is consumed by the Scheduled script, I get SSS_USAGE_LIMIT_EXCEEDED as soon as I try to run the Scheduled script. If I change it to a function expression and trigger it later on in the code, it works fine.. anyone had this issue and knows why it happens?
n
why not just use it as a function then?
n
@NickSuite that wasn’t the question 🙂 I am, and it works, but I’m interested in why it doesn’t work in a module..
n
No need to be rude buddy.
I am guessing because as soon as your module is loaded (even before your actual SS), it executes the function.
What does your IIF do?
n
@NickSuite not trying to be rude, sorry if that’s how it came across. Yeah that does make sense.. I guess I’m just confused by the error message not making sense to me. The function gets some data from the DB and puts it into a variable, data that should stay the same throughout the whole script execution and I only wanted to fetch it once, figured it would be nice to do the fetch in the beginning of the script and one time.
n
Since the function is executed even before the script, NetSuite doesn't have any idea about the governance, and throws the error. This is my idea
n
@NickSuite makes perfect sense, I really didn’t think about the order of execution in this case. Thanks a lot!
👍 1