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.
To use this feature, you define a script in Infoplus of a Script Type called "Warehouse Apps Input ". Note: you can only have 1-such script in your site. An example is shown below.
The script gets ran in the Infoplus Warehouse Ops apps any time a value is entered into the application. The script can manipulate the value that the user typed or scanned before it is sent to the Infoplus backend (for example, to remove digits from a barcode). When the script runs, there are 3 variables available in the runtime context:
- input - the string that they user scanned or keyed in
- context - an object containing 2 keys: app and screen, to indicate where the user is currently running.
You can see debugging output from the script by opening Chrome Developer Tools, clicking on the Console tab, and observing lines prefixed by Input Customizer. You can use these lines to see what possible values the context.app & context.screen variables will take.
Note that when you make changes to the script (ie, edit its code), you have to reload your (beta) warehouse app to reload the script to have your new changes take effect.
Making HTTP / API Calls
In addition, if the call you make returns JSON, you can translate this into an object using the browser's JSON object.
Here is an example of a script making an API call, to translate UPC codes on item records to SKU's:
- You must insert your own infoplus site's subdomain and an active API key into this script on the request.open and request.setRequestHeader lines.
- The requestListener function sets a global variable (GLOBAL_RESPONSE), which is then returned after the completion of the XMLHttpRequest send call.