This topic contains 6 replies, has 0 voices, and was last updated by ironside 8 years, 4 months ago.

  • Author
    Posts
  • #6356

    markrCMD7

    I 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.

  • #6357

    Olivier Gagnon NC

    Good God don’t do that!

  • #6358

    fourthwaveconsulting

    Yes 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.

  • #6359

    markrCMD7

    HAHA! 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.

  • #6360

    egrubaugh

    It 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.

  • #6361

    Nelliott

    If 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.

  • #6362

    ironside

    I 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.

You must be logged in to reply to this topic.