Scenario
An administrator notices that a Scheduled Script is consuming processing time continuously and needs to be stopped immediately. Typical troubleshooting attempts may include:
- Undeploying the script deployment
- Changing the deployment status
- Deleting the deployment record
- Removing the SuiteScript file from the File Cabinet
However, NetSuite may return errors indicating that the script is currently processing and cannot be modified.
This behavior can be unexpected for administrators who assume disabling the deployment will immediately stop the execution.
Solution
For SuiteScript 2.x Scheduled Scripts, undeploying or disabling the deployment does not stop the current execution. It only prevents future executions from starting. A running script must either:
- Complete successfully
- Fail due to an error
- Exit gracefully through logic built into the script itself
NetSuite does not provide a manual “terminate execution” option for active SuiteScript 2.x Scheduled Script executions.
It is also important to understand the difference between SuiteScript versions:
Script Type | Yielding Support |
|---|
SuiteScript 1.0 Scheduled Scripts | Supports nlapiYieldScript() |
SuiteScript 2.x Scheduled Scripts | No equivalent yielding or recovery point method |
For large-scale or long-running processes, Map/Reduce scripts are generally a better option because they include built-in yielding and governance handling.
Notes and Best Practices
To reduce the risk of Scheduled Scripts running indefinitely:
- Add defensive logic and exit conditions within scripts
- Monitor execution regularly using the Scheduled Script Status page
- Consider migrating heavy processing workloads to Map/Reduce scripts
- Test scripts thoroughly in Sandbox before deployment to Production
- Use governance-aware batching strategies for large datasets
If a script repeatedly becomes stuck, reviewing execution logs and governance usage can help identify loops, failed pagination logic, or unhandled exceptions.
For more information, here are some helpful articles: