Order Scripts

Updated 6 months ago by Cory M.

Users may create Orders Scripts using a built-in Javascript editor. These scripts can be run before an order is fully submitted through the ShipStream GUI or from the ShipStream API. Scripts help the user manage events that occur when an order is placed. A common example of where scripts are used is for placing an order "On Hold" if it meets a certain criteria.

How to Create a Script

  1. Navigate to Shipping > Order Scripts.
  2. Click Create New Script at the top right.
  3. Select the Merchant whose orders will have this script applied.
  4. Enter a unique name describing the script's action or purpose.
  5. Select the scope where you want this script to occur. For instance, a user may only want the script to run from the ShipStream GUI and not from the API. Any combination of the two options may be chosen.
  6. Change the Is Active field to Yes if you wish to use the script after it is saved, or leave it as No to disable it for now.
  7. Set a sort order if using multiple scripts to decide where it should run among the other scripts.
  8. Click Save.
If the script contains errors or invalid code then a red "X" or yellow warning sign will appear to the left of the line containing the error. Hover over the error signal to determine the problem.

Using Scripts

When a script is created from the GUI, then it is automatically executed before the order is placed, but directly after the user submits an order.

If your script contains semantic errors (such as a misspelled orders option) then a red Exception notification will appear to help you debug the issue with the line number of the error.

If the script is successfully executed then you should see no errors or warnings; only a green notification saying "The order has been created."


How did we do?