How to Automatically Pre-Cartonize Orders

Use a trigger in Infoplus to set up your orders to automatically pre-cartonize ahead of picking.

Pre-cartonization is the process of manually examining the contents of an order and using the dimensions of each item to determine the size and amount of cartons that each order will need to be shipped.

In Infoplus, you can pick, pack and ship multiple orders at one time using cartonization. Additionally, pre-cartonization is required if you are going to use Rate Shopping. 

Pre-Cartonization Trigger Action

You can set up a Pre-Cartonization Trigger Action to have orders automatically run pre-cartonization when orders are uploaded into Infoplus or updated. If a pre-cartonization action is assigned to a trigger, then any orders matching the trigger's filter will automatically run through pre-cartonization.

To run pre-cartonization, all Line Items have to have a footprint (length, width, height, and weight) and boxes that need to be taken into account need to be created on the Carton Type table.

If any other error occurs during the pre-cartonization process, an alert will be created with details of the failure.

How to Set Up Pre-Cartonization Trigger: 

1. Set your smart filter on the order table 

2. Navigate to Manage Triggers

3. Create a New Trigger with a specific name

4. Set the smart filter associated with this trigger and Save

5. Click on the '0' in the Actions Column for the Trigger you just created

6. Add 'Run Pre-Cartonization' as the Action Type

7. Add a script if you have a specific action you want to run (see script example below)

       


Pre-Cartonization Trigger Action Scripts

Scripts can be used for cartonization at three different points:

  • customizeAvailableCartons - Customize the cartons allowed for the given order during cartonization.
  • customizeCartonizationCall - Customize if Infoplus should run cartonization on the given order.
  • customizeCartonizationOutput - Customize the output of cartonization on the given order.

Example Script:

// To customize Infoplus Cartonization, you can define the following functions, for customizing different pieces of the integration:
// customizeAvailableCartons - Customize the cartons allowed for the given order during cartonization.
// customizeCartonizationCall - Customize if Infoplus should run cartonization on the given order.
// customizeCartonizationOutput - Customize the output of cartonization on the given order.
//
// In each of these functions, the following global variables will be available:
//
// order - an instance of an Infoplus API Order model, for the order cartonization is being ran against.
//
// originalCartonList - object containing the list of Infoplus Carton API models availble by default.
//
// utils - object with the following methods:
// .log(message) - add a line to the Script Output's log.
// .getOriginalCartonList() - returns the original Carton list being passed into Cartonization.
// .setOutputCartonList(cartonList) - sets the list of Cartons that will actually be used by Cartonization.
// .setShouldRunCartonization(true/flase) - sets if Infoplus should run its internal Cartonization.
//
// infoplusApi - object which provides access to the Infoplus API, specifically, with the following methods:
// .search(type, filter, pageNo, limit, orderBy) - run a search query in the Infoplus API.
// .getById(type, id) - get the record of the specified type identified by the id.
// .getTags(type, id) - get the tags from Infoplus for the specified record.
// .constructModel(type) - used to construct an API model object of the given type.
// - See the https://developer.infopluscommerce.com/ for more details.
//
// Example:


////////////////////////////////////////////////////////////////////////////
// customizeAvailableCartons
//
////////////////////////////////////////////////////////////////////////////
function customizeAvailableCartons()
{
utils.log("Starting customizeAvailableCartons");
utils.log("Running for Order: " + order.orderNo);

////////////////////////////////
// set the output carton list //
////////////////////////////////
var originalCartonList = utils.originalCartonList;
utils.setOutputCartonList(originalCartonList);
}


////////////////////////////////////////////////////////////////////////////
// customizeCartonizationCall
//
////////////////////////////////////////////////////////////////////////////
function customizeCartonizationCall()
{
utils.log("Starting customizeCartonizationCall");
utils.log("Running for Order: " + order.orderNo);
utils.setShouldRunCartonization(true);
}


////////////////////////////////////////////////////////////////////////////
// customizeCartonizationOutput
//
////////////////////////////////////////////////////////////////////////////
function customizeCartonizationOutput()
{
utils.log("Starting customizeCartonizationOutput");
utils.log("Running for Order1: " + order.orderNo);

var cartonizationOutput = utils.cartonizationOutput;
cartonizationOutput.clearCartons();

var allContents = cartonizationOutput.getAllContents();
utils.log("allContents: " + allContents);

var carton1 = utils.createNewContainer(318);

for(var i=0; i<allContents.size(); i++)
{
var cartonizationItem = cartonizationOutput.getAllContents().get(i);

utils.log("cartonizationItem1: " + cartonizationItem);
carton1.addContent(cartonizationItem);
}
}