Make Any Value Scannable via the Warehouse Apps Input Script

Turn any value stored in Infoplus into a scannable input to streamline your pick, pack, and ship process.

You can utilize a customizable "Warehouse Apps Input" script in which allows Infoplus to access the API in between the time an input is scanned and the value is returned.
This script can change the value read in a Warehouse App, before it is sent to Infoplus. If the script returns a value, it will be sent to Infoplus instead of the value that the user entered.
If the script does not return anything, the user-entered value will be sent to Infoplus.
For example, users may have custom alias fields, such as Amazon SKU. If you want to scan these values, this script allows users to scan the Amazon SKU and in real-time it will return the Infoplus SKU that is associated with it so that it works in the Infoplus Mobile Apps. 

Use Case: 

An Infoplus client that stores car keys and car titles for rental companies utilizes the Product ID Tag field of Infoplus to capture the VIN number for each vehicle they receive keys/titles for. Whenever the rental companies request the keys/title, they have an API order system that utilizes an override for item receipt feature to make sure that the specific VIN is allocated for each specific order.
Additionally, once items are picked and they get to the pack station, users can simply scan the VIN found on the key or title and their 'Warehouse App Input' script is set up to search the order line table for PIT's, and will return the order associated with the one in question - no paperwork or other barcodes necessary. 

Example Warehouse Apps Input Script: 

// A script of this type has the following variables available:
//
// input - string - value scanned or keyed into the app by the user
// context - object - 2 keys:  app and screen - indicate what app & screen the user is on when the input value was read.
// console - object - the javascript console object - can be used to issue log message, e.g., console.log('trimming value')
//
// If this script returns a value, it will be sent to Infoplus instead of the value that the user entered.
// If the script does not return anything, the user-entered value will be sent to Infoplus.
//
// Example:

console.log('input customizer');


The section below is declaring global variables and setting a function for an event listener (the scanner). 

var GLOBAL_RESPONSE;
var GLOBAL_ORDER;

function requestListener () {
    console.log("Response text: " + this.responseText);
    var responseObject = JSON.parse(this.responseText);
    console.log("Response object: " + responseObject);
    if(responseObject && responseObject.length > 0)
    {
        GLOBAL_RESPONSE = responseObject[0].sku;
        GLOBAL_ORDER = responseObject[0].orderNo;
        console.log("Returning sku: " + GLOBAL_RESPONSE);
        console.log("Returning order: " + GLOBAL_ORDER);
    }
}

Next, there is a function created for whatever search is going to be needed, in the example below there is a function for an item search, and I included one that searches the order table just for reference. It's important that our customers put in their site URL and an accurate API key from their user table. 

function orderSearch(field, value)
{
    var request = new XMLHttpRequest();
    request.addEventListener("load", requestListener);
    request.open("GET", "https://CUSTOMER-SITE.infopluswms.com/infoplus-wms/api/beta/order/search?filter=" + field + "+eq+'" + value + "'", false);
    request.setRequestHeader("API-Key", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    request.setRequestHeader("Content-Type", "application/json");
    request.send();
   
    return(GLOBAL_ORDER);
}

function itemSearch(field, value)
{
    var request = new XMLHttpRequest();
    request.addEventListener("load", requestListener);
    request.open("GET", "https://CUSTOMER-SITE.infopluswms.com/infoplus-wms/api/beta/item/search?filter=" + field + "+eq+'" + value + "'", false);
    request.setRequestHeader("API-Key", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    request.setRequestHeader("Content-Type", "application/json");
    request.send();
   
    return(GLOBAL_RESPONSE);
}

Now we can set the variables for each mobile application context screen. You can find the context of any screen you are in by using the console log of Inspector Element.

Infoplus_Warehouse_Apps.png
  • var isItemInquiry = (context.app == 'item-inquiry');
  • var isReceiving = (context.app == 'interactive-receiving' && (context.screen == 'scan-identifier' || context.screen == 'select-asn-line'));
  • var isFulfillmentPick = (context.app == 'perform-fulfillment-pick-work' && (context.screen == 'error-scan-item' || context.screen == 'scan-item'));
  • var isPackStation = (context.app === 'pack-station');
  • var isPackStationItem = (context.app == 'pack-station' && context.screen == 'scan-item');
  • var isPackStationOrder = (context.app == 'pack-station' && context.screen == 'scan-order');
  • var isRelocation = (context.app == 'inventory-relocation' && (context.screen == 'scan-start-input' || context.screen == 'scan-start-input-error'));
  • var isAdjustment = (context.app == 'adjust-inventory' &&  (context.screen == 'scan-start-input' || context.screen == 'scan-start-input-error'));
  • var isInventoryStatus = (context.app == 'change-inventory-status' && (context.screen == 'scan-start-input' || context.screen == 'scan-start-input-error'));

We have an if statement set to determine if any of the context screens from above are currently in use. If so, we call the functions that were set earlier and return the global response (item / sku, in this example)

if(isRelocation || isAdjustment || isInventoryStatus || isItemInquiry || isReceiving)

{
    console.log("Searching API for UPC= " + input);

    var sku = itemSearch("vendorSKU", input);
    if(sku)
    {
        return(sku);
    }
   
    var sku = itemSearch("upc", input);
    if(sku)
    {
        utils.log("UPC Search Ran");
        return(sku);
    }

    var sku = itemSearch("custom.upc2", input);
    if(sku)
    {
        utils.log("UPC2 Search Ran");
        return(sku);
    }
   
    sku = itemSearch("custom.upc3", input);
    if(sku)
    {
        utils.log("UPC3 Search Ran");
        return(sku);
    }
   
    sku = itemSearch("custom.upc4", input);
    if(sku)
    {
        utils.log("UPC4 Search Ran");
        return(sku);
    }
   
    sku = itemSearch("custom.pickUPC", input);
    if(sku)
    {
        utils.log("pickUPC Search Ran");
        return(sku);
    }
}


// if (isPackStation || isPackStationOrder || isOrderInquiry)
// {
//     console.log("Searching Order API for Order with Fulfillment Process " + input);
//
//     var order = orderSearch("fulfillmentProcessId", input);
//     if(order)
//     {
//         console.log("Returning Order " + order + ".");
//         return(order);
//     }
//    
// }