Due to the ever-changing nature of writing and maintaining scripts, Infoplus does not provide support in this area. We recommend someone in your IT Department handles scripting requests internally so that you keep all control over the process.
When inventory (that is allowed to be placed on backorder) cannot be allocated to an Order (e.g. low quantity, frozen status, etc.), a new Order record (per backorder item) with a status of "Back Order" for the outstanding quantity will be created.
NOTE: Items can only be placed on backorder when the Item record indicates so. To indicate that an item can be placed on backorder, you need to select Yes in the Backorder field which you'll find in the Purchasing tab of the Item record.
Status Backorder Consolidator:
If an order has multiple backorders you can consolidate those backorders into one order.
1. Access the Script table. Two ways:
From the Dashboard: Click the Apps tab, click the Scripts App, then click the Script table.
From the Quick Actions shortcut: Press a dot (period) on your keyboard, then select the Script table from the list of Quick Actions.
2. Click the Create New button at the top right of the page then the "Creating New Script" screen appears.
3. Complete the necessary fields at the top:
- Input 'Backorder Consolidator' in the Name field.
- Select 'Record' as the Script Type.
- Select 'Beta' as the API Version, then copy and paste the below script in the Code field:
var HAS_BEEN_RAN_TAG = "ran-bo-consolidator"; ////////////////////////////////////////////////////////////////////////// // only run this script on the .001 backorder (ie, not .002, .003, etc) // ////////////////////////////////////////////////////////////////////////// if(! new String(order.orderNo).match(/\.001/)) { utils.log("Taking no-action on this order [" + order.orderNo + "], as it is not the .001 backorder") return; } utils.log("Proceeding with this order [" + order.orderNo + "], as it is the .001 backorder"); ///////////////////////////////////////////////////////////////////////////////// // check for the HAS_BEEN_RAN_TAG - if we find it, we don't want to run again. // ///////////////////////////////////////////////////////////////////////////////// var tags = infoplusApi.getTags("order", order.orderNo); if(tags.contains(HAS_BEEN_RAN_TAG)) { utils.log("Taking no-action on this order [" + order.orderNo + "], as it has the " + HAS_BEEN_RAN_TAG + " tag on it."); return; } ////////////////////////////////////////////////////////////////////////////////// // look backorders on this same root order number (ie, between X.002 and X.999) // ////////////////////////////////////////////////////////////////////////////////// var orderNoRoot = Math.round(order.orderNo, 0); var minOrderNo = orderNoRoot + .002; var maxOrderNo = orderNoRoot + .999; var filter = "orderNo between (" + minOrderNo + ", " + maxOrderNo + ") and status in ('Back Order', 'On Order')"; var otherBackorders = infoplusApi.search("Order", filter, null, 100, null); utils.log("Size of otherBackorders: " + otherBackorders.size()); /////////////////////////////////////////////////////////////////// // if there were no other backorders, no further work is needed. // /////////////////////////////////////////////////////////////////// if(otherBackorders.size() == 0) { utils.log("Found no other backorders - exiting with no action."); //////////////////////////////////////////////////////// // tag the order so the script won't run on it again // //////////////////////////////////////////////////////// infoplusApi.addTag("order", order.orderNo, HAS_BEEN_RAN_TAG); return; } /////////////////////////////////////////////////////////////////////////// // move line items from the other back orders onto this order (the .001) // /////////////////////////////////////////////////////////////////////////// for(var i=0; i<otherBackorders.size(); i++) { var otherBackorder = otherBackorders.get(i); var lineItem = otherBackorder.lineItems.get(0); utils.log("other backorder " + otherBackorder.orderNo + " has line item: " + lineItem.sku); order.addToLineItems(lineItem); lineItem.orderNo = order.orderNo; } ///////////////////////////////////////////////////////////////////////////// // update this order (the .001), marking as ship-complete (via holdCode=Y) // ///////////////////////////////////////////////////////////////////////////// order.holdCode = "Y"; utils.log("all our line items: " + order.lineItems.size()); infoplusApi.update("Order", order); /////////////////////////////////////////////////////// // tag the order so the script won't run on it again // /////////////////////////////////////////////////////// infoplusApi.addTag("order", order.orderNo, HAS_BEEN_RAN_TAG); ///////////////////////////////////// // delete all the other backorders // ///////////////////////////////////// for(var i=0; i<otherBackorders.size(); i++) { var orderToDelete = otherBackorders.get(i); utils.log("deleting order: " + orderToDelete.orderNo); infoplusApi.delete("Order", orderToDelete.orderNo); } utils.log("Finished");
3. Create a new Filter for Orders that are in a Backorder state and do not have the "ran-bo-consolidator" tag.
4. Create a Scheduled Script Plan using the Filter and script that were just created and adjust the schedule on the plan to run as often as required.