This topic contains 6 replies, has 0 voices, and was last updated by ironside 8 years, 4 months ago.
-
AuthorPosts
-
July 11, 2016 at 10:55 am #6356
markrCMD7I recently have seen a SSS_USAGE_LIMIT_EXCEEDED error on one of my scripts and in looking up some options I found this site that states that the getRemainingUsage function of nlapiGetContext() can be overridden and forced to always return as whatever the override sets it to.
I realize this could be a dangerous work around and I’m planning on looking into other alternatives like optimizing my script, but in the meantime I’m curious if anyone can confirm if this work around is viable or if this is out dated and no longer works this way.
-Thanks
This is a cached copy. Click here to see the original post. -
July 11, 2016 at 11:17 am #6357
Olivier Gagnon NCGood God don’t do that!
-
July 11, 2016 at 12:51 pm #6358
fourthwaveconsultingYes I agree with Oliver, you could accidentally build an infinite loop and have trouble reigning in the script. Just check for time & usage remaining and yield the script, and reschedule it. There are some helpful examples in NS help for SS v1, not sure about V2.
-
July 11, 2016 at 2:10 pm #6359
markrCMD7HAHA! I had a feeling looking at the code like it would be a really bad idea, like I said I don’t plan on doing it and hadn’t planned on doing it.
Mostly it was curiosity, like would that really work? It sounds like the answer is in short “yes but DON’T!” – Thanks for the replies.
-
July 11, 2016 at 3:12 pm #6360
egrubaughIt does actually work, yes. Given that it’s javascript and there is no `private` access modifier, you can override pretty much any function/property of the NetSuite API.
As everyone previous has said, don’t do it. Instead, post your relevant code, and we’ll be able to help provide suggestions for optimization.
-
July 12, 2016 at 3:57 am #6361
NelliottIf you’re working with a Scheduled Script you should look at something on the lines of this:
Code:
if (nlapiGetContext().getRemainingUsage() < 50) {
nlapiYieldScript();
}
If you're not using a Scheduled Script maybe look to move the bulk of your code into one and calling that SS from your script.You'll probably appreciate an SS has a governance of 10k and can be rescheduled as outlined above.
These are my immediate thoughts but it rather depends on the context of what you're trying to achieve.
-
July 13, 2016 at 8:02 am #6362
ironsideI haven’t tried it myself but would be surprised if it did work in the general case. You can definitely override what your client thinks the remaining governance is but I suspect the NS server side is keeping track and is the real source of truth as far as governance goes.
If it isn’t, shame on NS.
-
AuthorPosts
You must be logged in to reply to this topic.