How To Stop A Map/Reduce SuiteScript When It Is Processing

How do you stop a long running map/reduce script in SuiteScript?

There are two ways to stop the running of a map/reduce script: cancel the script in the Map/Reduce Script Status area, or make the running Map/Reduce script inactive .

Here’s how each method works.

Cancel Map/Reduce Script

You might be able to stop a map/reduce script running in SuiteScript if there are other scripts running currently and your newly pushed map/reduce script is sitting in the queue.

To access the Map/Reduce Script queue navigate to the Customatization > Scripting > Map/Reduce Scripts Status page.

From here you will see a list of Map/Reduce Scripts. If the filter area is available change the Date to today and make the filter for Status set to Unfinished . This will greatly reduce the scripts in queue and make it easier for you to find your pending script.

When you see the map/reduce scripts that are yet to finish you might have the ability to Cancel your pending script, in which case click on the Cancel link:

To cancel a Map/Reduce script before it processes click the Cancel link on the Map/Reduce Script Status screen

When you’ve successfully clicked the Cancel link the row containing your script will disappear from this view.

Stop A Map/Reduce Script That Is Processing

What if you get to the Map/Reduce Script Status screen and the script you want to stop is already processing?

For this you’ll need to click on the Script link which opens up the Script record. Click on Edit and then check the Inactive box.

Once you save the Script record you can return back to the Map/Reduce Script Status screen and within a minute or few, your script should stop.

When you’re ready for the script to run again you can make the script active by unchecking the Inactive box.

Summary

There are two ways to prevent a map/reduce script from running in your NetSuite instance. The first is the easiest and less invasive way of stopping the script and only requires you to go to the Map/Reduce Script Status section and click the Cancel link. The other way is also somewhat simple and just requires you to make the running script Inactive .

Photo of author
Ryan Sheehy
Ryan has been dabbling in code since the late '90s when he cut his teeth exploring VBA in Excel. Having his eyes opened with the potential of automating repetitive tasks, he expanded to Python and then moved over to scripting languages such as HTML, CSS, Javascript and PHP.