https://netsuiteprofessionals.com logo
#suitescript
Title
# suitescript
n

Nikola Gavric

04/22/2022, 11:13 AM
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

NickSuite

04/22/2022, 11:15 AM
why not just use it as a function then?
n

Nikola Gavric

04/22/2022, 11:15 AM
@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

NickSuite

04/22/2022, 11:19 AM
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

Nikola Gavric

04/22/2022, 11:21 AM
@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

NickSuite

04/22/2022, 11:23 AM
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

Nikola Gavric

04/22/2022, 11:24 AM
@NickSuite makes perfect sense, I really didn’t think about the order of execution in this case. Thanks a lot!
👍 1