Infoplus offers an out-of-the-box warehouse transfer feature that enables our users to create orders in one warehouse and seamlessly receive them into a different destination warehouse. 

When you utilize the transfer feature, the ASN for the new warehouse location will end in '-T' (to signify Transfer). The ASN will have a PO with the Order Number and then end in the '-T', creating something like this: 1.000-T. 

In order for the Transfer ASN to be created, users must first Execute the Transfer from the action menu dropdown of the order in question. With the use of Infoplus Scripts, it becomes possible for our users to streamline this process. 

The script below will take an order and turn it into an ASN automatically. With the correct inputs, Infoplus can detect these orders and automatically create your Transfer ASN. 

This also offers a lot more flexibility within the ASN as the script will allow you to populate any values across any of the ASN fields. For example, if you don't like the standard 1.000-T nomenclature you can update it to something like "1.000-Transfer" or whatever makes sense for you. Custom fields can be populated as well. 

How to Implement a Transfer Order Script: 

1. In Infoplus, go to the Script table. 

One of Two Ways

  • Dashboard: Apps>Tools>Scripts>Tables>Scripts
  • Quick Actions Shortcut: Press a dot (period) on your keyboard, then select 'Script' from the list of Quick Actions.

  1. Once you are on the Scripts Table, click the Create New button in the top right corner. 

  2. Fill out the required fields 
    • Name: Enter a descriptive name to identify this script by 
    • Script Type: select 'Manifest' from the dropdown menu
    • API Version Beta

        3. Enter the JavaScript Code for the script noted below.

Please Note: Be careful to read through the script comments so that you have it coded properly for your specific use case(s). To test, you can manually run the script on existing orders by selecting 'Run Script' or 'Bulk Run Script' via the actions menu on the item table.

Example Code: 

// This script will create an ASN that mirrors an Order record. 
utils.log("Starting Script To Create ASN");

// first we will set the vendor ID for the transfer ASN. In this example, 399 relates to a vendor that we have created specifically for transfers. 

var VENDOR_ID = 399;

// Call the construct model to create a new ASN
utils.log("Creating new ASN record");
var asn = infoplusApi.constructModel("ASN");
asn.vendorId = VENDOR_ID;
asn.lobId = record.lobId;
asn.orderDate = new Date();

// IMPORTANT: You will need to specify the destination warehouse ID so that the ASN //is created in the correct warehouse. You can choose to hardcode this field with ID's //from your warehouse table, or you may want to consider a custom field or some //mechanism of controlling what warehouse the ASN is needed in. 
asn.warehouseId =  WAREHOUSE-ID-GOES-HERE

// iterate over order lines, consolidating shipped qtys 
var consolidatedLineItems = {} // map of SKU to shipped qty.
for(var i=0; i<order.lineItems.size(); i++)
    var sourceLineItem = order.lineItems.get(i);
    var sku = sourceLineItem.sku;
    var orderedQuantity = Number(sourceLineItem.orderedQty);
    var poOverride = sourceLineItem.overrideReceiptsForFulfillmentList; 
    if(poOverride == null)
        utils.log("A PO was not specified for " + sku + " on order " + order.orderNo + "."); 
        var poNo = "Rep Delivery " + order.orderNo; 
        var getOverride = poOverride.get(0);
        var getReceipt = getOverride.itemReceiptId; 
        utils.log("Found Item Receipt ID of " + getReceipt + " for sku " + sku + " on order " + order.orderNo + "."); 

    // search item receipt for PO to make sure it doesn't exist
    var searchReceipts ="itemReceipt", "id eq '" + getReceipt + "'", null, null, null);
    if (searchReceipts)
        var getReceipt = searchReceipts.get(0); 
        var poNo = getReceipt.legacyPoNo; 
        utils.log("Found a PO of " + poNo + " for sku " + sku + " on order " + order.orderNo + "."); 
        var poNo = "N/A"; 
        utils.log("Could Not Find a PO for sku " + sku + " on order " + order.orderNo + ".");     
    if(orderedQuantity > 0)
            consolidatedLineItems[sku] += orderedQuantity;
            consolidatedLineItems[sku] = orderedQuantity;

// search to see if ASN already exists //
var newPO = "Rep Delivery - " + poNo; 
var filter = "poNo eq '" + newPO + "'";
utils.log("Searching for existing ASN with [" + filter + "]");

var itemList ="asn", filter, null, 1, null);
if(itemList.size() > 0)
   utils.log("Found existing ASN with poNo of '" + poNo + "', exiting...");

asn.poNo = newPO;

// iterate over line items, creating ASN lines for each 

for(var sku in consolidatedLineItems)
    var asnLineItem = infoplusApi.constructModel("ItemReceipt");
    asnLineItem.orderQuantity = consolidatedLineItems[sku];
    asnLineItem.sku = sku;
    asnLineItem.lobId = 11828;
// execute the ASN creation
var newAsn = infoplusApi.add("ASN", asn);

// how to populate or update a custom ASN field
//newAsn.customFields.put("transferOrder", order.orderNo); 
//infoplusApi.updateCustomFields("asn", newAsn);

2. Navigate to the Orders Table and Setup and Save a Smart Filter with the following filters:

  • Transfer Orders
  • Pending Status

    Pro Tip: The warehouse service type will have a value of 'Transfer' and the status field will have a value of 'Pending' that can be selected. All orders will be in a pending status for the first few seconds of their lifecycle in Infoplus. It is in this stage where Infoplus is analyzing the order and running any triggers that may apply to it.

3. Save the Smart Filter and name is something related to the Transfer Orders action

4. Now you will need to create a trigger to activate the smart filter and script. Navigate to the Manage Trigger Table via one of two ways

  • 1 - Use the period key and begin typing 'Order', then click on Order from the drop-down
  • 2 - Navigate to the Apps>Account>Building Blocks>Manage Triggers from the Infoplus dashboard

5. Once you are on the Manage Triggers table, select 'Create New' in the top right and fill in the required fields:

  • Name: Transfer Orders (or any identifying description you would like to use)
  • Description: any additional identifying information
  • Smart Filter: Select the Transfer Orders Smart Filter (that you just created) from the drop-down
  • Make sure 'Insert' is checked
  • Set Active to 'Yes'
  • Then click 'OK'

6.  Once the trigger is created, you will need to add an action to run the script. 

  • Stay on the Manage Triggers Page
  • Find the Trigger in the Table and Navigate to the 'Actions' column
  • Click on the Number in the Actions column associated with your Trigger
  • Click on 'Create New'
  • From the dropdown menu for 'Action Type', select 'Run Script'
  • Then, select the Transfer Script you created in Step 1
  • Click Save 

5. Create a new transfer order to test the trigger/script. Within a few seconds of the order being in an 'on order' status, you should have visibility of the ASN. If you do not see it, check your script logs for any errors.